From 2eeb0f7f96b6c8e0780452bc157a8143291cba4b Mon Sep 17 00:00:00 2001 From: DeJusten Date: Fri, 14 Mar 2025 11:00:34 +0100 Subject: [PATCH] core/thread: document thread_add_to_list() Adding the task to the linked list is graphically commented --- core/thread.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/core/thread.c b/core/thread.c index 24ef5f79de..c7880b3c4d 100644 --- a/core/thread.c +++ b/core/thread.c @@ -160,6 +160,29 @@ void thread_yield(void) thread_yield_higher(); } +/* + * Example of insertion operations in the linked list + * thread_add_to_list(list,new_node) //Prio4 + * list list new_node + * +------+ +------+ +------+ + * | + | -> | + | | 4 + | + * +----|-+ +----|-+ +----|-+ + * +-->NULL +-----/\ +-->NULL + * thread_add_to_list(list,higher_node) //Prio2(Higher) + * list new_node higher_node + * +------+ +------+ +------+ + * | + | | 4 + | | 2 + | + * +----|-+ +----|-+ +----|-+ + * | +-->NULL | + * | /\-------------+ + * +----------------/\ + * thread_add_to_list(list,lower_node) //Prio6(Lower) + * list new_node lower_node + * +------+ +------+ +------+ + * | + | | 4 + | | 6 + | + * +----|-+ +----|-+ +----|-+ + * +-----/\ +-----/\ +-->NULL + */ void thread_add_to_list(list_node_t *list, thread_t *thread) { assert(thread->status < STATUS_ON_RUNQUEUE);