kernel: tickless: Add function to check if list contains multiple nodes

Scheduler needs to do time slicing only if there are multiple threads
active with the same priority. This function checks if the list has
more than one node. This would be used to check the list containing
threads with same priority for multiple nodes.

Jira: ZEP-339
Change-Id: I8c7daf77a6540c642ce58a3763b26cd1e06ddc30
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
This commit is contained in:
Ramesh Thomas 2017-02-28 15:08:24 -08:00 committed by Anas Nashif
parent fcb4ea1383
commit 0b3322ecae

View File

@ -225,6 +225,19 @@ static inline int sys_dlist_is_empty(sys_dlist_t *list)
return list->head == list;
}
/**
* @brief check if more than one node present
*
* @param list the doubly-linked list to operate on
*
* @return 1 if multiple nodes, 0 otherwise
*/
static inline int sys_dlist_has_multiple_nodes(sys_dlist_t *list)
{
return list->head != list->tail;
}
/**
* @brief get a reference to the head item in the list
*