From 0b3322ecaebef4c00d3e5de6e2f7d466531c4e15 Mon Sep 17 00:00:00 2001 From: Ramesh Thomas Date: Tue, 28 Feb 2017 15:08:24 -0800 Subject: [PATCH] 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 --- include/misc/dlist.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/misc/dlist.h b/include/misc/dlist.h index 7926203d086..2826bf2a8dc 100644 --- a/include/misc/dlist.h +++ b/include/misc/dlist.h @@ -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 *