kernel: Split reschdule & pend into irq/spin lock versions
Just like with _Swap(), we need two variants of these utilities which can atomically release a lock and context switch. The naming shifts (for byte count reasons) to _reschedule/_pend_curr, and both have an _irqlock variant which takes the traditional locking. Just refactoring. No logic changes. Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
parent
fb505b3cfd
commit
ec554f44d9
22 changed files with 87 additions and 66 deletions
|
@ -109,7 +109,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 */
|
||||
result = _pend_current_thread(key, &slab->wait_q, timeout);
|
||||
result = _pend_curr_irqlock(key, &slab->wait_q, timeout);
|
||||
if (result == 0) {
|
||||
*mem = _current->base.swap_data;
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ void k_mem_slab_free(struct k_mem_slab *slab, void **mem)
|
|||
if (pending_thread != NULL) {
|
||||
_set_thread_return_value_with_data(pending_thread, 0, *mem);
|
||||
_ready_thread(pending_thread);
|
||||
_reschedule(key);
|
||||
_reschedule_irqlock(key);
|
||||
} else {
|
||||
**(char ***)mem = slab->free_list;
|
||||
slab->free_list = *(char **)mem;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue