Home | History | Annotate | Download | only in os

Lines Matching refs:sema

403 pipe_semaphore_init(pipe_semaphore *sema, int init_val)
405 pipe_mutex_init(sema->mutex);
406 pipe_condvar_init(sema->cond);
407 sema->counter = init_val;
411 pipe_semaphore_destroy(pipe_semaphore *sema)
413 pipe_mutex_destroy(sema->mutex);
414 pipe_condvar_destroy(sema->cond);
419 pipe_semaphore_signal(pipe_semaphore *sema)
421 pipe_mutex_lock(sema->mutex);
422 sema->counter++;
423 pipe_condvar_signal(sema->cond);
424 pipe_mutex_unlock(sema->mutex);
429 pipe_semaphore_wait(pipe_semaphore *sema)
431 pipe_mutex_lock(sema->mutex);
432 while (sema->counter <= 0) {
433 pipe_condvar_wait(sema->cond, sema->mutex);
435 sema->counter--;
436 pipe_mutex_unlock(sema->mutex);