i am making binary semaphore shared between multiple processes(not threads , Process Only) using POSIX in C language. if i create binary semaphore using mutex,
typedef struct BIN_SEMA
{
pthread_cond_t cv; /* cond. variable
- used to block threads */
pthread_mutex_t mutex; /* mutex variable
- used to prevents concurrent
access to the variable "flag" */
int flag; /* Semaphore state:
0 = down, 1 = up */
} bin_sema;
i will be able to use it amongst the threads only , but i want to share between processes. so my question is, how to make binary semaphore using posix counting semaphores ?