#define UNLOCKED 1 ... int futex_down(futex_t *ftx) { if (*ftx == UNLOCKED) { *ftx--; return 0; } return sys_ftx_wait(ftx); }