When pshared is 0, the semaphore can be used by all the threads in this process only.
#include <semaphore.h> sem_t sem; int ret; int count = 4; /* to be used within this process only */ ret = sem_init(&sem, 0, count);