ia64/xen-unstable

view extras/mini-os/include/sched.h @ 18742:183d2d7adc2f

minios: Define __INSIDE_MINIOS__ rather than __MINIOS__

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Oct 29 12:04:38 2008 +0000 (2008-10-29)
parents 8d41996e6897
children
line source
1 #ifndef __SCHED_H__
2 #define __SCHED_H__
4 #include <mini-os/list.h>
5 #include <mini-os/time.h>
6 #include <mini-os/arch_sched.h>
7 #ifdef HAVE_LIBC
8 #include <sys/reent.h>
9 #endif
11 struct thread
12 {
13 char *name;
14 char *stack;
15 #if !defined(__ia64__)
16 /* keep in that order */
17 unsigned long sp; /* Stack pointer */
18 unsigned long ip; /* Instruction pointer */
19 #else /* !defined(__ia64__) */
20 thread_regs_t regs;
21 #endif /* !defined(__ia64__) */
22 struct minios_list_head thread_list;
23 u32 flags;
24 s_time_t wakeup_time;
25 #ifdef HAVE_LIBC
26 struct _reent reent;
27 #endif
28 };
30 extern struct thread *idle_thread;
31 void idle_thread_fn(void *unused);
33 #define RUNNABLE_FLAG 0x00000001
35 #define is_runnable(_thread) (_thread->flags & RUNNABLE_FLAG)
36 #define set_runnable(_thread) (_thread->flags |= RUNNABLE_FLAG)
37 #define clear_runnable(_thread) (_thread->flags &= ~RUNNABLE_FLAG)
39 #define switch_threads(prev, next) arch_switch_threads(prev, next)
41 /* Architecture specific setup of thread creation. */
42 struct thread* arch_create_thread(char *name, void (*function)(void *),
43 void *data);
45 void init_sched(void);
46 void run_idle_thread(void);
47 struct thread* create_thread(char *name, void (*function)(void *), void *data);
48 void exit_thread(void) __attribute__((noreturn));
49 void schedule(void);
51 #ifdef __INSIDE_MINIOS__
52 #define current get_current()
53 #endif
55 void wake(struct thread *thread);
56 void block(struct thread *thread);
57 void msleep(u32 millisecs);
59 #endif /* __SCHED_H__ */