The sem_init function creates a semaphore with a specified name and unique identification number. Use this function to allocate a new semaphore that will be used with the functions sem_grab and sem_release. Call sem_init from an init class function to initialize a static or global variable that the other classes will later use.
#include <base/sem.h> SEMAPHORE sem_init(char *name, int number);
The constant SEM_ERROR if an error occurred.
SEMAPHORE *name is the name for the requested semaphore. The file name of the semaphore should be a file accessible to the process.
int number is the unique identification number for the requested semaphore.