k_thread_abort(): assert if abort essential thread

Previously, this was only done if an essential thread self-exited,
and was a runtime check that generated a kernel panic.

Now if any thread has k_thread_abort() called on it, and that thread
is essential to the system operation, this check is made. It is now
an assertion.

_NANO_ERR_INVALID_TASK_EXIT checks and printouts removed since this
is now an assertion.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2017-08-28 16:02:24 -07:00 committed by Andrew Boie
commit 8eaff5d6d2
15 changed files with 8 additions and 35 deletions

View file

@ -18,6 +18,7 @@
#include <linker/sections.h>
#include <wait_q.h>
#include <ksched.h>
#include <misc/__assert.h>
extern void _k_thread_single_abort(struct k_thread *thread);
@ -28,6 +29,9 @@ void k_thread_abort(k_tid_t thread)
key = irq_lock();
__ASSERT(!(thread->base.user_options & K_ESSENTIAL),
"essential thread aborted");
_k_thread_single_abort(thread);
_thread_monitor_exit(thread);