sched/semaphore.c
/*
 * sem_init - initialize the semaphore
 *
 * @sem       - the semaphore address
 * @pshared   - ignored
 * @value     - the semaphore initial value
 *
 * Initialize the semaphore with a specified value.
 *
 */
initialize the semaphore
@sem       - the semaphore address
@pshared   - ignored
@value     - the semaphore initial value

Initialize the semaphore with a specified value.
initialize the semaphore @sem - the semaphore address @pshared - ignored @value - the semaphore initial value Initialize the semaphore with a specified value .
int sem_init(sem_t *sem, int pshared, unsigned int value)
{
  if (sem == NULL)
  {
    return -1;
  }
  sem->count = value;
  return 0;
}
int sem_init ( sem_t * sem , int pshared , unsigned int value ) { if ( sem == NULL ) { return -1 ; } sem -> count = value ; return 0 ; }
sem_init - initialize the semaphore
 @sem       - the semaphore address
 @pshared   - ignored
 @value     - the semaphore initial value
sem_init - initialize the semaphore @sem - the semaphore address @pshared - ignored @value - the semaphore initial value