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:
Peter Mitsis 2016-09-16 10:08:52 -04:00 committed by Benjamin Walsh
commit bd69658571

View file

@ -178,6 +178,11 @@ int __must_switch_threads(void)
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 */
void k_thread_priority_set(struct tcs *thread, int prio)
{