Reputation: 1532
You know we can use message queues with the function mq_receive(); what is a good way to implement that functionality (you know, waiting until the shared data is changed) with semaphores?
Upvotes: 0
Views: 186
Reputation: 754790
The standard way:
If you have multiple consumers and multiple producers, you ensure that the semaphore has enough range to allow for multiple requests to be queued by the producers and you ensure that the consumers know how to handle perhaps several of them being active at once. All of this is standard multi-processing (multi-threading) theory, though.
If you need a run-down on the operations required, then you need to look at the POSIX manual pages for:
System V IPC
POSIX IPC
Upvotes: 1