/* other, me are threadID's with values 0, 1 */ int turn ; int need[2] = { FALSE, FALSE }; void wait() { need(me) = TRUE ; turn = other ; while (need[other] && (turn != me)); } void signal() { need(me) = FALSE ; }