wargames/semtex/semtex12.sem.c
void down(int *sem)
{
retry:
        while(*sem)
                sleep(5);
        (*sem)++;
        if(*sem > 1) {
                (*sem)--;
                goto retry;
        }
        return;
}
/* Get the semaphore and busy wait if held already */
Get the semaphore and busy wait if held already
Get the semaphore and busy wait if held already
void down(int *sem)
{
retry:
        while(*sem)
                sleep(5);
        (*sem)++;
        if(*sem > 1) {
                (*sem)--;
                goto retry;
        }
        return;
}
void down ( int * sem ) { retry : while ( * sem ) sleep ( 5 ) ; ( * sem ) ++ ; if ( * sem > 1 ) { ( * sem ) -- ; goto retry ; } return ; }
Get the semaphore and busy wait if held already
Get the semaphore and busy wait if held already