The sem_grab function requests exclusive access to a specified semaphore. If exclusive access is unavailable, the caller blocks execution until exclusive access becomes available. Use this function to ensure that only one server processor thread performs an action at a time.
#include <base/sem.h> int sem_grab(SEMAPHORE id);
-1 if an error occurred
0 to signal success
SEMAPHORE id is the unique identification number of the requested semaphore.