kernel: add fiber_wakeup()

Like for the other context-specific APIs, also provide a
context-agnostic wrapper.

Change-Id: Icf0a62f4c06aec42f0febc298edbd8bdeec63749
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
This commit is contained in:
Benjamin Walsh 2016-02-24 15:32:32 -05:00
commit fcfb4b6bda
2 changed files with 25 additions and 0 deletions

View file

@ -280,6 +280,20 @@ extern void fiber_fiber_wakeup(nano_thread_id_t fiber);
*/
extern void task_fiber_wakeup(nano_thread_id_t fiber);
/**
* @brief Wake the specified fiber from sleep
*
* This routine is a convenience wrapper for the execution of context-specific
* APIs. It is helpful when the exact execution context is not known. However,
* it should be avoided when the context is known up-front to avoid
* unnecessary overhead.
*
* @param fiber Identifies fiber to wake
*
* @return N/A
*/
extern void fiber_wakeup(nano_thread_id_t fiber);
#ifndef CONFIG_MICROKERNEL
/**
* @brief Put the task to sleep.

View file

@ -69,6 +69,17 @@ void task_fiber_wakeup(nano_thread_id_t fiber)
}
}
void fiber_wakeup(nano_thread_id_t fiber)
{
static void (*func[3])(nano_thread_id_t) = {
isr_fiber_wakeup,
fiber_fiber_wakeup,
task_fiber_wakeup
};
func[sys_execution_context_type_get()](fiber);
}
#ifndef CONFIG_MICROKERNEL
void task_sleep(int32_t timeout_in_ticks)
{