atomically wait for this semaphore to become non-zero and decrement it . concode_field_sep ThreadQueue waitQueue concode_elem_sep Semaphore ping concode_elem_sep Semaphore pong concode_elem_sep int value concode_field_sep void selfTest concode_elem_sep void V concode_elem_sep void run
void function ( ) { boolean loc0 = Machine . interrupt ( ) . disable ( ) ; if ( value == 0 ) { waitQueue . waitForAccess ( KThread . currentThread ( ) ) ; KThread . sleep ( ) ; } else { value -- ; } Machine . interrupt ( ) . restore ( loc0 ) ; }