kernel: Allow pending w/o wait_q for scheduler API cleanup
The mailbox code was written to use the _remove_thread_from_ready_q() API directly, which would be good to get out of the scheduler internal API. What it really wanted to do is to mark a thread "PENDING" without actually adding it to a wait queue, which is sane enough (the message stores the "thread to wake up on receipt" handle). So allow that naturally in the _pend_thread() API by passing a NULL wait_q. Really a wait_q needn't be the only way a thread can block. Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
parent
64eb789ff5
commit
b481d0a045
|
@ -285,8 +285,7 @@ static int mbox_message_put(struct k_mbox *mbox, struct k_mbox_msg *tx_msg,
|
|||
* synchronous send: pend current thread (unqueued)
|
||||
* until the receiver consumes the message
|
||||
*/
|
||||
_remove_thread_from_ready_q(_current);
|
||||
_mark_thread_as_pending(_current);
|
||||
_pend_current_thread(NULL, K_FOREVER);
|
||||
return _Swap(key);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -203,6 +203,10 @@ void _pend_thread(struct k_thread *thread, _wait_q_t *wait_q, s32_t timeout)
|
|||
sys_dlist_t *wait_q_list = (sys_dlist_t *)wait_q;
|
||||
struct k_thread *pending;
|
||||
|
||||
if (!wait_q_list) {
|
||||
goto inserted;
|
||||
}
|
||||
|
||||
SYS_DLIST_FOR_EACH_CONTAINER(wait_q_list, pending, base.k_q_node) {
|
||||
if (_is_t1_higher_prio_than_t2(thread, pending)) {
|
||||
sys_dlist_insert_before(wait_q_list,
|
||||
|
|
Loading…
Reference in a new issue