How to create a POSIX semaphore on shared memory for unrelated processes?
807578Mar 3 2009 — edited Mar 4 2009Hi,
Can you please guide me about my query on creating & initializing semaphore in shared memory?
I would like to create a POSIX semaphore in POSIX shared memory and then use this semaphore across two different, unrelated processes to synchronize the writes and reads to another shared memory segment.
I tried to use sema_init with USYNC_PROCESS and passing it the sem_t pointer which is pointing to share memory space. But only the first process comes out of sema_wait when another process does sema_post.
Is there any way that we can achieve this by using POSIX semaphore APIs? How can we do this?
Please guide.