sched: add thread status flags

This commit is contained in:
2023-03-19 20:35:48 +00:00
parent 768e6c4ff6
commit ae848e9776

View File

@@ -17,11 +17,16 @@ typedef enum task_state {
} task_state_t; } task_state_t;
typedef enum thread_state { typedef enum thread_state {
THREAD_READY, THREAD_READY = 1,
THREAD_SLEEPING, THREAD_SLEEPING = 2,
THREAD_STOPPED, THREAD_STOPPED = 3,
} thread_state_t; } thread_state_t;
typedef enum thread_flags {
THREAD_F_NEED_RESCHED = 0x01u,
THREAD_F_NO_PREEMPT = 0x02u,
} thread_flags_t;
typedef enum sched_priority { typedef enum sched_priority {
PRIO_IDLE = 4, PRIO_IDLE = 4,
PRIO_SUBNORMAL = 6, PRIO_SUBNORMAL = 6,
@@ -45,7 +50,8 @@ typedef struct task {
} task_t; } task_t;
typedef struct thread { typedef struct thread {
thread_state_t tr_state; thread_state_t tr_state : 8;
thread_flags_t tr_flags : 8;
task_t *tr_parent; task_t *tr_parent;
unsigned int tr_id; unsigned int tr_id;