pt
pt copied to clipboard
pt_wait - do not suspend if cond true on entry
I'm probably missing something but why can't you:
#define pt_wait(pt, cond) \
do { \
if ((cond)) { \
break; \
} \
pt_label(pt, PT_STATUS_BLOCKED); \
if (!(cond)) { \
return; \
} \
} while (0)
This form would mimic the typical condition-variable signature, which typically does not block if the condition is true.