Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to create a POSIX semaphore on shared memory for unrelated processes?

807578Mar 3 2009 — edited Mar 4 2009
Hi,
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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 1 2009
Added on Mar 3 2009
1 comment
505 views