source: trunk/packages/xen-common/xen-common/extras/mini-os/include/sched.h @ 34

Last change on this file since 34 was 34, checked in by hartmans, 17 years ago

Add xen and xen-common

File size: 1.3 KB
Line 
1#ifndef __SCHED_H__
2#define __SCHED_H__
3
4#include <list.h>
5#include <time.h>
6#include <arch_sched.h>
7
8struct 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
23extern struct thread *idle_thread;
24void 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. */
35struct thread* arch_create_thread(char *name, void (*function)(void *),
36                                  void *data);
37
38void init_sched(void);
39void run_idle_thread(void);
40struct thread* create_thread(char *name, void (*function)(void *), void *data);
41void schedule(void);
42
43#define current get_current()
44
45
46void wake(struct thread *thread);
47void block(struct thread *thread);
48void sleep(u32 millisecs);
49
50#endif /* __SCHED_H__ */
Note: See TracBrowser for help on using the repository browser.