From 7bc86c03443f0299d1575d4b6829d97e017bc73c Mon Sep 17 00:00:00 2001 From: Benjamin Walsh Date: Thu, 29 Sep 2016 11:03:51 -0400 Subject: [PATCH] unified: use sys_dlist_peek_head_not_empty() When fetching the next thread to run, we know at least one thread is available. Change-Id: I568c33a61b6a0a6d6a7f79c337caecffd5ef70b6 Signed-off-by: Benjamin Walsh --- kernel/unified/sched.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/unified/sched.c b/kernel/unified/sched.c index fb96d377372..59828078cfa 100644 --- a/kernel/unified/sched.c +++ b/kernel/unified/sched.c @@ -149,11 +149,14 @@ struct tcs *_get_next_ready_thread(void) int prio = _get_highest_ready_prio(); int q_index = _get_ready_q_q_index(prio); sys_dlist_t *list = &_nanokernel.ready_q.q[q_index]; - struct k_thread *thread = (struct k_thread *)sys_dlist_peek_head(list); - __ASSERT(thread, "no thread to run (prio: %d, queue index: %u)!\n", + __ASSERT(!sys_dlist_is_empty(list), + "no thread to run (prio: %d, queue index: %u)!\n", prio, q_index); + struct k_thread *thread = + (struct k_thread *)sys_dlist_peek_head_not_empty(list); + return thread; }