79#define PROCESS_ERR_OK 0
87#define PROCESS_ERR_FULL 1
90#define PROCESS_NONE NULL
92#ifndef PROCESS_CONF_NUMEVENTS
93#define PROCESS_CONF_NUMEVENTS 255
94#define PROCESS_CONF_NUMEVENTS_PRINT 64
95#define PROCESS_CONF_NUMEVENTS_ERROR 230
98#define PROCESS_EVENT_NONE 0x80
99#define PROCESS_EVENT_INIT 0x81
100#define PROCESS_EVENT_POLL 0x82
101#define PROCESS_EVENT_EXIT 0x83
102#define PROCESS_EVENT_SERVICE_REMOVED 0x84
103#define PROCESS_EVENT_CONTINUE 0x85
104#define PROCESS_EVENT_MSG 0x86
105#define PROCESS_EVENT_EXITED 0x87
106#define PROCESS_EVENT_TIMER 0x88
107#define PROCESS_EVENT_COM 0x89
108#define PROCESS_EVENT_MAX 0x8a
110#define PROCESS_BROADCAST NULL
111#define PROCESS_ZOMBIE ((struct process *)0x1)
127#define PROCESS_BEGIN() PT_BEGIN(process_pt)
138#define PROCESS_END() PT_END(process_pt)
148#define PROCESS_WAIT_EVENT() PROCESS_YIELD()
164#define PROCESS_WAIT_EVENT_UNTIL(c) PROCESS_YIELD_UNTIL(c)
171#define PROCESS_YIELD() PT_YIELD(process_pt)
185#define PROCESS_YIELD_UNTIL(c) PT_YIELD_UNTIL(process_pt, c)
199#define PROCESS_WAIT_UNTIL(c) PT_WAIT_UNTIL(process_pt, c)
200#define PROCESS_WAIT_WHILE(c) PT_WAIT_WHILE(process_pt, c)
207#define PROCESS_EXIT() PT_EXIT(process_pt)
218#define PROCESS_PT_SPAWN(pt, thread) PT_SPAWN(process_pt, pt, thread)
228#define PROCESS_PAUSE() \
230 process_post(PROCESS_CURRENT(), PROCESS_EVENT_CONTINUE, NULL); \
231 PROCESS_WAIT_EVENT(); \
250#define PROCESS_POLLHANDLER(handler) \
251 if (ev == PROCESS_EVENT_POLL) { \
265#define PROCESS_EXITHANDLER(handler) \
266 if (ev == PROCESS_EVENT_EXIT) { \
287#define PROCESS_THREAD(name, ev, data) \
288 static PT_THREAD(process_thread_##name(struct pt *process_pt, \
289 process_event_t ev, \
290 process_data_t data))
300#define PROCESS_NAME(name) extern struct process name
315#if PROCESS_CONF_NO_PROCESS_NAMES
316#define PROCESS(name, strname) \
317 PROCESS_THREAD(name, ev, data); \
318 struct process name = {NULL, process_thread_##name}
320#define PROCESS(name, strname) \
321 PROCESS_THREAD(name, ev, data); \
322 struct process name = {NULL, strname, process_thread_##name}
329#if PROCESS_CONF_NO_PROCESS_NAMES
330#define PROCESS_NAME_STRING(process) ""
333#define PROCESS_NAME_STRING(process) (process)->name
434#define PROCESS_CURRENT() process_current
458#define PROCESS_CONTEXT_BEGIN(p) \
460 struct process *tmp_current = PROCESS_CURRENT(); \
473#define PROCESS_CONTEXT_END(p) \
474 process_current = tmp_current; \
560#define PROCESS_LIST() process_list
#define CC_REENTRANT_ARG
Definition: cc.h:57
#define CCIF
Definition: contiki-conf.h:24
CCIF struct process * process_list
Definition: process.c:60
process_event_t process_alloc_event(void)
Allocate a global event number.
Definition: process.c:113
void process_poll(struct process *p) CC_REENTRANT_ARG
Definition: process.c:475
int process_is_running(struct process *p) CC_REENTRANT_ARG
Definition: process.c:485
int process_run(void)
Definition: process.c:348
unsigned char process_event_t
Definition: process.h:64
CCIF struct process * process_current
Definition: process.c:61
void process_post_synch(struct process *p, process_event_t ev, process_data_t data) CC_REENTRANT_ARG
Definition: process.c:465
void process_start(struct process *p, const char *arg) CC_REENTRANT_ARG
Definition: process.c:118
uint32_t process_num_events_t
Definition: process.h:66
int process_post(struct process *p, process_event_t ev, process_data_t data) CC_REENTRANT_ARG
Definition: process.c:366
int process_nevents(void)
Definition: process.c:361
void process_init(void)
Initialize the process module.
Definition: process.c:259
void * process_data_t
Definition: process.h:65
void process_exit(struct process *p) CC_REENTRANT_ARG
Cause a process to exit.
Definition: process.c:254
int process_count_events(const struct process *p, process_event_t ev, const process_data_t data) CC_REENTRANT_ARG
Definition: process.c:448
Definition: process.h:327
unsigned char needspoll
Definition: process.h:337
PT_THREAD((*thread)(struct pt *, process_event_t, process_data_t))
unsigned char state
Definition: process.h:337
const char * name
Definition: process.h:332
struct process * next
Definition: process.h:328