Line | |
---|
1 | #ifndef __SCHED_H__ |
---|
2 | #define __SCHED_H__ |
---|
3 | |
---|
4 | #include <list.h> |
---|
5 | #include <time.h> |
---|
6 | #include <arch_sched.h> |
---|
7 | |
---|
8 | struct thread |
---|
9 | { |
---|
10 | char *name; |
---|
11 | char *stack; |
---|
12 | #if !defined(__ia64__) |
---|
13 | unsigned long sp; /* Stack pointer */ |
---|
14 | unsigned long ip; /* Instruction pointer */ |
---|
15 | #else /* !defined(__ia64__) */ |
---|
16 | thread_regs_t regs; |
---|
17 | #endif /* !defined(__ia64__) */ |
---|
18 | struct list_head thread_list; |
---|
19 | u32 flags; |
---|
20 | s_time_t wakeup_time; |
---|
21 | }; |
---|
22 | |
---|
23 | extern struct thread *idle_thread; |
---|
24 | void idle_thread_fn(void *unused); |
---|
25 | |
---|
26 | #define RUNNABLE_FLAG 0x00000001 |
---|
27 | |
---|
28 | #define is_runnable(_thread) (_thread->flags & RUNNABLE_FLAG) |
---|
29 | #define set_runnable(_thread) (_thread->flags |= RUNNABLE_FLAG) |
---|
30 | #define clear_runnable(_thread) (_thread->flags &= ~RUNNABLE_FLAG) |
---|
31 | |
---|
32 | #define switch_threads(prev, next) arch_switch_threads(prev, next) |
---|
33 | |
---|
34 | /* Architecture specific setup of thread creation. */ |
---|
35 | struct thread* arch_create_thread(char *name, void (*function)(void *), |
---|
36 | void *data); |
---|
37 | |
---|
38 | void init_sched(void); |
---|
39 | void run_idle_thread(void); |
---|
40 | struct thread* create_thread(char *name, void (*function)(void *), void *data); |
---|
41 | void schedule(void); |
---|
42 | |
---|
43 | #define current get_current() |
---|
44 | |
---|
45 | |
---|
46 | void wake(struct thread *thread); |
---|
47 | void block(struct thread *thread); |
---|
48 | void sleep(u32 millisecs); |
---|
49 | |
---|
50 | #endif /* __SCHED_H__ */ |
---|
Note: See
TracBrowser
for help on using the repository browser.