ia64/xen-unstable

annotate extras/mini-os/include/sched.h @ 16838:945820bfedb6

minios: POSIX fixes
Fixes some functions which are POSIX. Also make them ifndef HAVE_LIBC.

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