1 #ifndef __RAK_THREAD_H__ 2 #define __RAK_THREAD_H__ 4 #define LABEL_INIT(s) s = NULL 6 #define LABEL_RESUME(s) \ 13 #define LABEL_CONCAT2(s1, s2) s1##s2 14 #define LABEL_CONCAT(s1, s2) LABEL_CONCAT2(s1, s2) 16 #define LABEL_SET(s) \ 18 LABEL_CONCAT(LABEL_LABEL, __LINE__): \ 19 (s) = &&LABEL_CONCAT(LABEL_LABEL, __LINE__); \ 44 #define RT_INIT(rt) LABEL_INIT((rt)->label) 57 #define RT_BEGIN(rt) { char RT_YIELD_FLAG = 1; LABEL_RESUME((rt)->label) 70 #define RT_END(rt) LABEL_END((rt)->label); RT_YIELD_FLAG = 0; \ 71 RT_INIT(rt); return RT_ENDED; } 85 #define RT_WAIT_UNTIL(rt, condition) \ 87 LABEL_SET((rt)->label); \ 105 #define RT_WAIT_WHILE(rt, cond) RT_WAIT_UNTIL((rt), !(cond)) 119 #define RT_WAIT_THREAD(rt, thread) RT_WAIT_WHILE((rt), RT_SCHEDULE(thread)) 134 #define RT_SPAWN(rt, child, thread) \ 137 RT_WAIT_THREAD((rt), (thread)); \ 151 #define RT_RESTART(rt) \ 168 #define RT_EXIT(rt) \ 185 #define RT_SCHEDULE(f) ((f) < RT_EXITED) 198 #define RT_YIELD(rt) \ 201 LABEL_SET((rt)->label); \ 202 if(RT_YIELD_FLAG == 0) { \ 219 #define RT_YIELD_UNTIL(rt, cond) \ 222 LABEL_SET((rt)->label); \ 223 if((RT_YIELD_FLAG == 0) || !(cond)) { \ 240 #define RT_SLEEP(rt, delay) \ 243 static unsigned long protothreads_sleep; \ 244 protothreads_sleep = millis(); \ 245 RT_WAIT_UNTIL(rt, millis() - protothreads_sleep > delay); \ Definition: RAKThread.h:24
void * label
Definition: RAKThread.h:25