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:
parent
8606fabf74
commit
e0a572beeb
15 changed files with 28 additions and 45 deletions
|
@ -101,8 +101,7 @@ int k_mem_slab_alloc(struct k_mem_slab *slab, void **mem, s32_t timeout)
|
|||
result = -ENOMEM;
|
||||
} else {
|
||||
/* wait for a free block or timeout */
|
||||
_pend_current_thread(&slab->wait_q, timeout);
|
||||
result = _Swap(key);
|
||||
result = _pend_current_thread(key, &slab->wait_q, timeout);
|
||||
if (result == 0) {
|
||||
*mem = _current->base.swap_data;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue