kernel: Refactor, unifying _pend_current_thread() + _Swap() idiom

Everywhere the current thread is pended, the code is going to have to
do a _Swap() soon afterward, yet the scheduler API exposed these as
separate steps.  Unify this pattern everywhere it appears, which saves
some code bytes and gets _Swap() out of the general scheduler API at
zero cost.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
Andy Ross 2018-03-26 11:58:10 -07:00 committed by Anas Nashif
commit e0a572beeb
15 changed files with 28 additions and 45 deletions

View file

@ -224,8 +224,8 @@ void *k_queue_get(struct k_queue *queue, s32_t timeout)
return k_queue_poll(queue, timeout);
#else
_pend_current_thread(&queue->wait_q, timeout);
int ret = _pend_current_thread(key, &queue->wait_q, timeout);
return _Swap(key) ? NULL : _current->base.swap_data;
return ret ? NULL : _current->base.swap_data;
#endif /* CONFIG_POLL */
}