ia64/xen-unstable

view extras/mini-os/include/sched.h @ 16732:b18f70656fdb

minios: Add exit_thread prototype. Make sure exit_thread doesn't
return by accident.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jan 17 14:40:06 2008 +0000 (2008-01-17)
parents d46265d21dc5
children 945820bfedb6
line source
1 #ifndef __SCHED_H__
2 #define __SCHED_H__
4 #include <list.h>
5 #include <time.h>
6 #include <arch_sched.h>
8 struct thread
9 {
10 char *name;
11 char *stack;
12 #if !defined(__ia64__)
13 /* keep in that order */
14 unsigned long sp; /* Stack pointer */
15 unsigned long ip; /* Instruction pointer */
16 #else /* !defined(__ia64__) */
17 thread_regs_t regs;
18 #endif /* !defined(__ia64__) */
19 struct list_head thread_list;
20 u32 flags;
21 s_time_t wakeup_time;
22 };
24 extern struct thread *idle_thread;
25 void idle_thread_fn(void *unused);
27 #define RUNNABLE_FLAG 0x00000001
29 #define is_runnable(_thread) (_thread->flags & RUNNABLE_FLAG)
30 #define set_runnable(_thread) (_thread->flags |= RUNNABLE_FLAG)
31 #define clear_runnable(_thread) (_thread->flags &= ~RUNNABLE_FLAG)
33 #define switch_threads(prev, next) arch_switch_threads(prev, next)
35 /* Architecture specific setup of thread creation. */
36 struct thread* arch_create_thread(char *name, void (*function)(void *),
37 void *data);
39 void init_sched(void);
40 void run_idle_thread(void);
41 struct thread* create_thread(char *name, void (*function)(void *), void *data);
42 void exit_thread(void) __attribute__((noreturn));
43 void schedule(void);
45 #define current get_current()
48 void wake(struct thread *thread);
49 void block(struct thread *thread);
50 void sleep(u32 millisecs);
52 #endif /* __SCHED_H__ */