kernel: scheduling fix for ARM
[minix.git] / lib / libddekit / src / thread.h
blob322fa6223d0d3107ec5b1e43875aa144f18c9304
1 #ifndef DDEKIT_SRC_THREAD_H
2 #define DDEKIT_SRC_THREAD_H 1
3 #include <ddekit/thread.h>
4 #include <ddekit/semaphore.h>
5 #include <setjmp.h>
7 #define DDEKIT_THREAD_NAMELEN 32
8 #define DDEKIT_THREAD_PRIOS 3
9 #define DDEKIT_THREAD_STDPRIO 1
11 #define DDEKIT_THREAD_STACKSIZE (4096*16)
13 /* This threadlib makes following assumptions:
14 * No Preemption,
15 * No signals,
16 * No blocking syscalls
17 * Threads cooperate.
20 struct ddekit_thread {
21 int id;
22 int prio;
23 void (*fun)(void *);
24 char *stack;
25 void *arg;
26 void *data;
27 unsigned sleep_until;
28 char name[DDEKIT_THREAD_NAMELEN];
29 jmp_buf jb;
30 ddekit_sem_t *sleep_sem;
31 struct ddekit_thread * next;
35 void _ddekit_thread_set_myprio(int prio);
36 void _ddekit_thread_enqueue(ddekit_thread_t *th);
37 void _ddekit_thread_schedule();
38 void _ddekit_thread_wakeup_sleeping();
39 void _ddekit_print_backtrace(ddekit_thread_t *th);
42 #endif