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?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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