thpool.c
/* Wait on semaphore until semaphore has value 0 */
Wait on semaphore until semaphore has value 0
Wait on semaphore until semaphore has value 0
static void bsem_wait(bsem *bsem_p) {
    pthread_mutex_lock(&bsem_p->mutex);
    while (bsem_p->v != 1) {
        pthread_cond_wait(&bsem_p->cond, &bsem_p->mutex);
    }
    bsem_p->v = 0;
    pthread_mutex_unlock(&bsem_p->mutex);
}
static void bsem_wait ( bsem * bsem_p ) { pthread_mutex_lock ( & bsem_p -> mutex ) ; while ( bsem_p -> v != 1 ) { pthread_cond_wait ( & bsem_p -> cond , & bsem_p -> mutex ) ; } bsem_p -> v = 0 ; pthread_mutex_unlock ( & bsem_p -> mutex ) ; }
Wait on semaphore until semaphore has value 0
Wait on semaphore until semaphore has value 0