mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
core: move thread_yield*() to thread.[ch]
Although it might conceptionally rather belong to the scheduler, the yield functions are prefixed with thread_ and thus, belong there.
This commit is contained in:
parent
6f53cd484d
commit
93ac114bc3
@ -157,20 +157,6 @@ extern volatile kernel_pid_t sched_active_pid;
|
||||
*/
|
||||
extern clist_node_t *sched_runqueues[SCHED_PRIO_LEVELS];
|
||||
|
||||
/**
|
||||
* @brief Lets current thread yield in favor of a higher prioritized thread.
|
||||
*
|
||||
* @details The current thread will resume operation immediately,
|
||||
* if there is no other ready thread with a higher priority.
|
||||
*
|
||||
* Differently from thread_yield() the current thread will be scheduled next
|
||||
* in its own priority class, i.e. it stays the first thread in its
|
||||
* priority class.
|
||||
*
|
||||
* @see thread_yield()
|
||||
*/
|
||||
void thread_yield_higher(void);
|
||||
|
||||
#if SCHEDSTATISTICS
|
||||
/**
|
||||
* Scheduler statistics
|
||||
|
@ -134,6 +134,20 @@ void thread_sleep(void);
|
||||
*/
|
||||
void thread_yield(void);
|
||||
|
||||
/**
|
||||
* @brief Lets current thread yield in favor of a higher prioritized thread.
|
||||
*
|
||||
* @details The current thread will resume operation immediately,
|
||||
* if there is no other ready thread with a higher priority.
|
||||
*
|
||||
* Differently from thread_yield() the current thread will be scheduled next
|
||||
* in its own priority class, i.e. it stays the first thread in its
|
||||
* priority class.
|
||||
*
|
||||
* @see thread_yield()
|
||||
*/
|
||||
void thread_yield_higher(void);
|
||||
|
||||
/**
|
||||
* @brief Wakes up a sleeping thread.
|
||||
*
|
||||
|
12
core/sched.c
12
core/sched.c
@ -179,15 +179,3 @@ NORETURN void sched_task_exit(void)
|
||||
sched_active_thread = NULL;
|
||||
cpu_switch_context_exit();
|
||||
}
|
||||
|
||||
void thread_yield(void)
|
||||
{
|
||||
unsigned old_state = disableIRQ();
|
||||
tcb_t *me = (tcb_t *)sched_active_thread;
|
||||
if (me->status >= STATUS_ON_RUNQUEUE) {
|
||||
clist_advance(&sched_runqueues[me->priority]);
|
||||
}
|
||||
restoreIRQ(old_state);
|
||||
|
||||
thread_yield_higher();
|
||||
}
|
||||
|
@ -89,6 +89,18 @@ int thread_wakeup(kernel_pid_t pid)
|
||||
}
|
||||
}
|
||||
|
||||
void thread_yield(void)
|
||||
{
|
||||
unsigned old_state = disableIRQ();
|
||||
tcb_t *me = (tcb_t *)sched_active_thread;
|
||||
if (me->status >= STATUS_ON_RUNQUEUE) {
|
||||
clist_advance(&sched_runqueues[me->priority]);
|
||||
}
|
||||
restoreIRQ(old_state);
|
||||
|
||||
thread_yield_higher();
|
||||
}
|
||||
|
||||
#ifdef DEVELHELP
|
||||
uintptr_t thread_measure_stack_free(char *stack)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user