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>
This commit is contained in:
parent
5792ee6da2
commit
22642cf309
16 changed files with 45 additions and 33 deletions
|
@ -489,27 +489,27 @@ _find_first_thread_to_unpend(_wait_q_t *wait_q, struct k_thread *from)
|
|||
|
||||
/* Unpend a thread from the wait queue it is on. Thread must be pending. */
|
||||
/* must be called with interrupts locked */
|
||||
static inline void _unpend_thread(struct k_thread *thread)
|
||||
{
|
||||
__ASSERT(thread->base.thread_state & _THREAD_PENDING, "");
|
||||
void _unpend_thread(struct k_thread *thread);
|
||||
|
||||
sys_dlist_remove(&thread->base.k_q_node);
|
||||
_mark_thread_as_not_pending(thread);
|
||||
}
|
||||
/* Same, but does not abort current timeout */
|
||||
void _unpend_thread_no_timeout(struct k_thread *thread);
|
||||
|
||||
/* unpend the first thread from a wait queue */
|
||||
/* must be called with interrupts locked */
|
||||
static inline struct k_thread *_unpend_first_thread(_wait_q_t *wait_q)
|
||||
struct k_thread *_unpend_first_thread(_wait_q_t *wait_q);
|
||||
|
||||
static inline struct k_thread *_unpend1_no_timeout(_wait_q_t *wait_q)
|
||||
{
|
||||
struct k_thread *thread = _find_first_thread_to_unpend(wait_q, NULL);
|
||||
|
||||
if (thread) {
|
||||
_unpend_thread(thread);
|
||||
_unpend_thread_no_timeout(thread);
|
||||
}
|
||||
|
||||
return thread;
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
/**
|
||||
* Indicate whether the currently running thread has been configured to be
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue