Wait on semaphore until semaphore has value 0 */
| 584 | |
| 585 | /* Wait on semaphore until semaphore has value 0 */ |
| 586 | static void bsem_wait(bsem *bsem_p) { |
| 587 | pthread_mutex_lock(&bsem_p->mutex); |
| 588 | while(bsem_p->v != 1) { |
| 589 | pthread_cond_wait(&bsem_p->cond, &bsem_p->mutex); |
| 590 | } |
| 591 | bsem_p->v = 0; |
| 592 | pthread_mutex_unlock(&bsem_p->mutex); |
| 593 | } |