-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathself_thread.h
More file actions
32 lines (29 loc) · 946 Bytes
/
self_thread.h
File metadata and controls
32 lines (29 loc) · 946 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef SELF_THREAD_H
#define SELF_THREAD_H
#include"all_include.h"
/*self thread structure*/
struct thread
{
char *th_name;
int th_id;
//priority: H=2, M=1, L=0
int b_priority;//original priority
int th_priority;//current priority
int th_cancelmode;//0=asynchronous, 1=deffer(notice: reclaimer can't goto the end)
int th_cancel_status;
int th_wait;//event I want wait(0~7), -1 = no waiting
long th_qtime;//queueing time
long th_wtime;//waiting time
long th_waittime;//save how long you need to wait
long th_already_wait;//use when ThreadWaitTime
ucontext_t th_ctx;//context recored
struct thread *th_next;
};
typedef struct thread thread_t;
typedef struct thread * thread_tptr;
/*multilevel feedback queue*/
void enq(thread_tptr *, thread_tptr *);
thread_tptr deq(thread_tptr *);
thread_tptr create_thread(char *, int, char *, int);
void priority_change(thread_tptr *, int, int);
#endif