kernel: Fix k_wakeup() exit paths
z_reschedule() already has a check to determine if it is called from the context of an ISR--no need to duplicate it in k_wakeup(). Furthermore, if the target thread is not sleeping, there is no need to reschedule and we can do a fast return. Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
This commit is contained in:
parent
48939cb44b
commit
c63b42d478
1 changed files with 6 additions and 14 deletions
|
@ -1164,21 +1164,13 @@ void z_impl_k_wakeup(k_tid_t thread)
|
|||
|
||||
k_spinlock_key_t key = k_spin_lock(&_sched_spinlock);
|
||||
|
||||
z_abort_thread_timeout(thread);
|
||||
|
||||
if (!z_is_thread_sleeping(thread)) {
|
||||
k_spin_unlock(&_sched_spinlock, key);
|
||||
return;
|
||||
}
|
||||
|
||||
z_mark_thread_as_not_sleeping(thread);
|
||||
|
||||
ready_thread(thread);
|
||||
|
||||
if (arch_is_in_isr()) {
|
||||
k_spin_unlock(&_sched_spinlock, key);
|
||||
} else {
|
||||
if (z_is_thread_sleeping(thread)) {
|
||||
z_abort_thread_timeout(thread);
|
||||
z_mark_thread_as_not_sleeping(thread);
|
||||
ready_thread(thread);
|
||||
z_reschedule(&_sched_spinlock, key);
|
||||
} else {
|
||||
k_spin_unlock(&_sched_spinlock, key);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue