kernel: Clean up _unpend_thread() API
Almost everywhere this was called, it was immediately followed by
_abort_thread_timeout(), for obvious reasons. The only exceptions
were in timeout and k_timer expiration (unifying these two would be
another good cleanup), which are peripheral parts of the scheduler and
can plausibly use a more "internal" API.
So make the common case the default, and expose the old behavior as
_unpend_thread_no_timeout(). (Along with identical changes for
_unpend_first_thread) Saves code bytes and simplifies scheduler
surface area for future synchronization work.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
diff --git a/kernel/stack.c b/kernel/stack.c
index 68aa9c7..2fe2ed8 100644
--- a/kernel/stack.c
+++ b/kernel/stack.c
@@ -80,12 +80,11 @@
first_pending_thread = _unpend_first_thread(&stack->wait_q);
if (first_pending_thread) {
- _abort_thread_timeout(first_pending_thread);
_ready_thread(first_pending_thread);
_set_thread_return_value_with_data(first_pending_thread,
0, (void *)data);
- _reschedule_noyield(key);
+ _reschedule(key);
return;
} else {
*(stack->next) = data;