Post to all threads */
| 576 | |
| 577 | /* Post to all threads */ |
| 578 | static void bsem_post_all(bsem *bsem_p) { |
| 579 | pthread_mutex_lock(&bsem_p->mutex); |
| 580 | bsem_p->v = 1; |
| 581 | pthread_cond_broadcast(&bsem_p->cond); |
| 582 | pthread_mutex_unlock(&bsem_p->mutex); |
| 583 | } |
| 584 | |
| 585 | /* Wait on semaphore until semaphore has value 0 */ |
| 586 | static void bsem_wait(bsem *bsem_p) { |