ia64/xen-unstable

annotate 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
rev   line source
kaf24@6714 1 #ifndef __SCHED_H__
kaf24@6714 2 #define __SCHED_H__
kaf24@6714 3
keir@18020 4 #include <mini-os/list.h>
keir@18020 5 #include <mini-os/time.h>
keir@18020 6 #include <mini-os/arch_sched.h>
keir@18020 7 #ifdef HAVE_LIBC
keir@18020 8 #include <sys/reent.h>
keir@18020 9 #endif
kaf24@6714 10
kaf24@6714 11 struct thread
kaf24@6714 12 {
kaf24@6714 13 char *name;
kaf24@6714 14 char *stack;
kfraser@12543 15 #if !defined(__ia64__)
keir@16434 16 /* keep in that order */
kaf24@9911 17 unsigned long sp; /* Stack pointer */
kaf24@9911 18 unsigned long ip; /* Instruction pointer */
kfraser@12543 19 #else /* !defined(__ia64__) */
kfraser@12543 20 thread_regs_t regs;
kfraser@12543 21 #endif /* !defined(__ia64__) */
keir@18296 22 struct minios_list_head thread_list;
kaf24@6714 23 u32 flags;
kfraser@12473 24 s_time_t wakeup_time;
keir@17042 25 #ifdef HAVE_LIBC
keir@17042 26 struct _reent reent;
keir@17042 27 #endif
kaf24@6714 28 };
kaf24@6714 29
kfraser@12543 30 extern struct thread *idle_thread;
kfraser@12543 31 void idle_thread_fn(void *unused);
kaf24@6714 32
kfraser@12543 33 #define RUNNABLE_FLAG 0x00000001
kfraser@12543 34
kfraser@12543 35 #define is_runnable(_thread) (_thread->flags & RUNNABLE_FLAG)
kfraser@12543 36 #define set_runnable(_thread) (_thread->flags |= RUNNABLE_FLAG)
kfraser@12543 37 #define clear_runnable(_thread) (_thread->flags &= ~RUNNABLE_FLAG)
kfraser@12543 38
kfraser@12543 39 #define switch_threads(prev, next) arch_switch_threads(prev, next)
kfraser@12543 40
kfraser@13522 41 /* Architecture specific setup of thread creation. */
kfraser@13522 42 struct thread* arch_create_thread(char *name, void (*function)(void *),
kfraser@13522 43 void *data);
kaf24@6714 44
kaf24@6714 45 void init_sched(void);
kaf24@6714 46 void run_idle_thread(void);
kaf24@6714 47 struct thread* create_thread(char *name, void (*function)(void *), void *data);
keir@16732 48 void exit_thread(void) __attribute__((noreturn));
kaf24@6714 49 void schedule(void);
kaf24@6714 50
keir@18742 51 #ifdef __INSIDE_MINIOS__
kaf24@6714 52 #define current get_current()
keir@18735 53 #endif
kaf24@6714 54
kaf24@6714 55 void wake(struct thread *thread);
kaf24@6714 56 void block(struct thread *thread);
keir@16838 57 void msleep(u32 millisecs);
kaf24@6714 58
kaf24@6714 59 #endif /* __SCHED_H__ */