Click here to Skip to main content
15,886,038 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I have multiple writers in a form of separate processes which will get a signal at the same time to start writing on a managed shared memory segment, each writer will create its own unique managed object. On the other hand I have one reader only as a separate process. Which can access this managed shared memory and has knowledge about the created managed objects by each writer. Due to this design I have the following two problems:

1. I want to find a way to let the last writer to signal the reader to start reading.
2. Maybe during the first phase of writing, another signal may arrive, and the writers have to write again on the shared memory. But they shouldn't do that, until the reader has finished reading the first phase.

So how can I solve these two problems using Boost library?
What Synchronization mechanism do I need? And how to do that?

Thanks a lot.
Posted

1 solution

The first item in this list[^] appears to what you're after
 
Share this answer
 
Comments
Mr.HA-AS 1-Apr-14 6:50am    
I checked it, but for my case I have to swap the logic between readers and writers only, correct? Or do I have to do something else?
barneyman 1-Apr-14 17:03pm    
you would have a lock per managed object - to solve #2 the reader would require an exclusive lock too

http://www.boost.org/doc/libs/1_55_0/doc/html/signals2.html may help with item #1

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900