unified: Add _is_next_thread_current()
The routine _is_next_thread_current() checks if the current thread is still the highest priority thread that is ready to run. It is useful for determining if a thread must be swapped out when timeslicing is in effect. Change-Id: Ide7b89742a64f6082ca4c679a4b2fbd60792e30f Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
This commit is contained in:
parent
685254f524
commit
bd69658571
1 changed files with 5 additions and 0 deletions
|
@ -178,6 +178,11 @@ int __must_switch_threads(void)
|
||||||
return _is_prio_higher(_get_highest_ready_prio(), _current->prio);
|
return _is_prio_higher(_get_highest_ready_prio(), _current->prio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int _is_next_thread_current(void)
|
||||||
|
{
|
||||||
|
return _get_next_ready_thread() == _current;
|
||||||
|
}
|
||||||
|
|
||||||
/* application API: change a thread's priority. Not callable from ISR */
|
/* application API: change a thread's priority. Not callable from ISR */
|
||||||
void k_thread_priority_set(struct tcs *thread, int prio)
|
void k_thread_priority_set(struct tcs *thread, int prio)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue