etc/services - sync with NetBSD-8
[minix.git] / minix / lib / libddekit / src / thread.h
blobbb05a45e904c20a9e2f19ddee6a1488bcd38f88c
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 <ucontext.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 ucontext_t ctx;
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_dequeue(ddekit_thread_t *th);
38 void _ddekit_thread_schedule();
39 void _ddekit_thread_wakeup_sleeping();
40 void _ddekit_print_backtrace(ddekit_thread_t *th);
43 #endif