kernel: move stuff into z_thread_single_abort()

The same code was being copypasted in k_thread_abort()
implementations, just move into z_thread_single_abort().

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2020-09-02 08:10:57 -07:00 committed by Andrew Boie
commit 3425c32328
4 changed files with 4 additions and 12 deletions

View file

@ -28,11 +28,7 @@ extern void z_thread_single_abort(struct k_thread *thread);
void z_impl_k_thread_abort(k_tid_t thread)
{
__ASSERT(!(thread->base.user_options & K_ESSENTIAL),
"essential thread aborted");
z_thread_single_abort(thread);
z_thread_monitor_exit(thread);
if (_current == thread) {
if (arch_is_in_isr()) {

View file

@ -493,11 +493,7 @@ void z_impl_k_thread_abort(k_tid_t thread)
key = irq_lock();
__ASSERT(!(thread->base.user_options & K_ESSENTIAL),
"essential thread aborted");
z_thread_single_abort(thread);
z_thread_monitor_exit(thread);
if (_current == thread) {
if (tstatus->aborted == 0) { /* LCOV_EXCL_BR_LINE */

View file

@ -479,6 +479,9 @@ static _wait_q_t *pended_on(struct k_thread *thread)
void z_thread_single_abort(struct k_thread *thread)
{
__ASSERT(!(thread->base.user_options & K_ESSENTIAL),
"essential thread aborted");
if (thread->fn_abort != NULL) {
thread->fn_abort();
}
@ -554,6 +557,7 @@ void z_thread_single_abort(struct k_thread *thread)
}
sys_trace_thread_abort(thread);
z_thread_monitor_exit(thread);
}
static void unready_thread(struct k_thread *thread)

View file

@ -27,11 +27,7 @@ extern void z_thread_single_abort(struct k_thread *thread);
#if !defined(CONFIG_ARCH_HAS_THREAD_ABORT)
void z_impl_k_thread_abort(k_tid_t thread)
{
__ASSERT((thread->base.user_options & K_ESSENTIAL) == 0U,
"essential thread aborted");
z_thread_single_abort(thread);
z_thread_monitor_exit(thread);
/* If we're in an interrupt handler, we reschedule on the way out
* anyway, nothing needs to be done here.