From f97ea89a4d23ac5e03e81d0d9396a6128daba2e2 Mon Sep 17 00:00:00 2001 From: pjht Date: Sun, 30 Aug 2020 09:41:50 -0500 Subject: [PATCH] Fix a bug where tasking_block would corrupt the tasking data structures --- kernel/tasking.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/tasking.c b/kernel/tasking.c index cc15121..f5a616b 100644 --- a/kernel/tasking.c +++ b/kernel/tasking.c @@ -70,6 +70,10 @@ void schedule_thread(Thread* thread) { // ready_to_run_tail->next_ready_to_run=thread; // thread->prev_ready_to_run=ready_to_run_tail; // ready_to_run_tail=thread; + if (thread==ready_to_run_head) { + serial_printf("TASKING DATA STRUCTURES CORRUPT!!!!\n"); + halt(); + } thread->next_ready_to_run=ready_to_run_head; ready_to_run_head->prev_ready_to_run=thread; ready_to_run_head=thread; @@ -270,7 +274,6 @@ void tasking_block(thread_state newstate) { } } current_thread->process->num_threads_blocked++; - unmark_proc_scheduled(current_thread->process->pid); tasking_yield(); }