-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy paththread.h
More file actions
23 lines (19 loc) · 751 Bytes
/
Copy paththread.h
File metadata and controls
23 lines (19 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#define STACK_SIZE 1024 //Define max size of thread_stack
#define THR_TASKS 32 //Define max size of thread
#define THREAD_STATUS_RUNNING 0//Status:running
#define THREAD_STATUS_SLEEP 1 //Status:sleep
#define THREAD_STATUS_READY 2 //Status:ready
#define THREAD_STATUS_EXIT 3 //Status:exit
struct thread_struct {
int id; //thread_id
void (*thread_func)();//The function for thread processing
int esp; // esp(Top of running stack)
unsigned int wakeuptime; // wakeuptime
int status; // The status of running
int counter; //The number of counter
int priority; // The priority value
int stack[STACK_SIZE];//Running stack
};
int thread_create(int *tid,void (*start_routine)());
int thread_join(int tid);
void mysleep(int seconds);