Add schedule node

This commit is contained in:
TXuian
2024-12-24 02:28:20 +08:00
parent 21304531a5
commit af1ceec308
14 changed files with 110 additions and 147 deletions
@@ -33,13 +33,14 @@ typedef struct RbtTree {
int nr_ele;
} RbtTree;
typedef void(rbt_traverse_fn)(RbtNode* node);
// return if the traverse needs to continue
typedef bool(rbt_traverse_fn)(RbtNode* node, void* data);
void rbtree_init(RbtTree* tree);
int rbt_insert(RbtTree* tree, uintptr_t key, void* data);
RbtNode* rbt_search(RbtTree* tree, uintptr_t key);
int rbt_delete(RbtTree* tree, uintptr_t key);
void rbt_traverse(RbtTree* tree, rbt_traverse_fn fn);
void rbt_traverse(RbtTree* tree, rbt_traverse_fn fn, void* data);
void module_rbt_factory_init(TraceTag* _softkernel_tag);
@@ -9,13 +9,13 @@
typedef uintptr_t snode_id_t;
enum ThreadState {
INIT = 0,
NEVER_RUN = 0,
INIT,
READY,
RUNNING,
DEAD,
BLOCKED,
SLEEPING,
NEVER_RUN,
NR_STATE,
};
@@ -49,6 +49,8 @@ Modification:
#define TASK_NAME_MAX_LEN 16
#define SLEEP_MONITOR_CORE 0
typedef int tid_t;
/* Thread Control Block */
struct ThreadContext {
struct Thread* task; // process of current thread
@@ -95,12 +97,6 @@ struct Thread {
bool advance_unblock; // @todo abandon
/* task schedule attributes */
// struct double_list_node node;
// struct TaskSleepContext sleep_context;
// enum ThreadState state;
// int priority; // priority
// int remain_tick;
// int maxium_tick;
struct ScheduleNode snode;
};