60 typedef unsigned char process_event_t;
61 typedef void * process_data_t;
62 typedef unsigned char process_num_events_t;
75 #define PROCESS_ERR_OK 0
83 #define PROCESS_ERR_FULL 1
86 #define PROCESS_NONE NULL
88 #ifndef PROCESS_CONF_NUMEVENTS
89 #define PROCESS_CONF_NUMEVENTS 32
92 #define PROCESS_EVENT_NONE 0x80
93 #define PROCESS_EVENT_INIT 0x81
94 #define PROCESS_EVENT_POLL 0x82
95 #define PROCESS_EVENT_EXIT 0x83
96 #define PROCESS_EVENT_SERVICE_REMOVED 0x84
97 #define PROCESS_EVENT_CONTINUE 0x85
98 #define PROCESS_EVENT_MSG 0x86
99 #define PROCESS_EVENT_EXITED 0x87
100 #define PROCESS_EVENT_TIMER 0x88
101 #define PROCESS_EVENT_COM 0x89
102 #define PROCESS_EVENT_MAX 0x8a
104 #define PROCESS_BROADCAST NULL
105 #define PROCESS_ZOMBIE ((struct process *)0x1)
121 #define PROCESS_BEGIN() PT_BEGIN(process_pt)
132 #define PROCESS_END() PT_END(process_pt)
142 #define PROCESS_WAIT_EVENT() PROCESS_YIELD()
158 #define PROCESS_WAIT_EVENT_UNTIL(c) PROCESS_YIELD_UNTIL(c)
165 #define PROCESS_YIELD() PT_YIELD(process_pt)
179 #define PROCESS_YIELD_UNTIL(c) PT_YIELD_UNTIL(process_pt, c)
193 #define PROCESS_WAIT_UNTIL(c) PT_WAIT_UNTIL(process_pt, c)
194 #define PROCESS_WAIT_WHILE(c) PT_WAIT_WHILE(process_pt, c)
201 #define PROCESS_EXIT() PT_EXIT(process_pt)
212 #define PROCESS_PT_SPAWN(pt, thread) PT_SPAWN(process_pt, pt, thread)
222 #define PROCESS_PAUSE() do { \
223 process_post(PROCESS_CURRENT(), PROCESS_EVENT_CONTINUE, NULL); \
224 PROCESS_WAIT_EVENT(); \
243 #define PROCESS_POLLHANDLER(handler) if(ev == PROCESS_EVENT_POLL) { handler; }
255 #define PROCESS_EXITHANDLER(handler) if(ev == PROCESS_EVENT_EXIT) { handler; }
274 #define PROCESS_THREAD(name, ev, data) \
275 static PT_THREAD(process_thread_##name(struct pt *process_pt, \
276 process_event_t ev, \
277 process_data_t data))
287 #define PROCESS_NAME(name) extern struct process name
302 #if PROCESS_CONF_NO_PROCESS_NAMES
303 #define PROCESS(name, strname) \
304 PROCESS_THREAD(name, ev, data); \
305 struct process name = { NULL, \
306 process_thread_##name }
308 #define PROCESS(name, strname) \
309 PROCESS_THREAD(name, ev, data); \
310 struct process name = { NULL, strname, \
311 process_thread_##name }
317 struct process *
next;
318 #if PROCESS_CONF_NO_PROCESS_NAMES
319 #define PROCESS_NAME_STRING(process) ""
322 #define PROCESS_NAME_STRING(process) (process)->name
324 PT_THREAD((* thread)(
struct pt *, process_event_t, process_data_t));
326 unsigned char state, needspoll;
366 CCIF
int process_post(
struct process *p, process_event_t ev,
void* data);
379 process_event_t ev,
void* data);
403 #define PROCESS_CURRENT() process_current
404 CCIF
extern struct process *process_current;
427 #define PROCESS_CONTEXT_BEGIN(p) {\
428 struct process *tmp_current = PROCESS_CURRENT();\
441 #define PROCESS_CONTEXT_END(p) process_current = tmp_current; }
525 CCIF
extern struct process *process_list;
527 #define PROCESS_LIST() process_list