sched: add a thread flag to indicate when a thread is scheduled on a runqueue

this prevents runqueue corruption that can occur if rq_enqueue is called on
a thread that's already on a runqueue.
This commit is contained in:
2026-03-14 22:22:05 +00:00
parent 7c630ece54
commit 89dac0c951
2 changed files with 19 additions and 1 deletions

View File

@@ -14,8 +14,11 @@ enum thread_state {
};
enum thread_flags {
/* this thread has exhausted its quantum and is due to be re-scheduled.
*/
THREAD_F_NEED_RESCHED = 0x01u,
THREAD_F_NO_PREEMPT = 0x02u,
/* this thread is currently scheduled (i.e. is present on a runqueue) */
THREAD_F_SCHEDULED = 0x04u,
};
struct thread {