Initializes a semaphore.
#include <semaphore.h> int sem_init ( sem_t *sem, int pshared, unsigned int value );
(IN) Points to the semaphore to initialize. Returns SEM_FAILED if the initialization fails.
(IN) Specifies whether the semaphore can be shared. This feature is unsupported on NetWare and this parameter must be set to 0.
(IN) Specifies the number of resources that the semaphore can protect and control.
If successful, returns zero; otherwise, returns -1 and sets errno to one of the following values:
Semaphores can be used to control access to a set of resources.