|
Boost Users : |
Subject: Re: [Boost-users] Mutex synchronised wrapper class for boost::interprocess vector of strings
From: Riskybiz (riskybizLive_at_[hidden])
Date: 2013-07-09 06:17:54
"It's not an easy task. You should catch the exception and then notify all
connected processes that should disconnected from the segment (as only
offline growing is supported). After that a process can call "grow"
to try extend the segment. Then, all processes can attach to the newly grown
segment.
Think of that as a complex binary file that must be extended and internal
structures changed. All users should close the file, the file should be
changed by a process and then all users can start using the file again."
OK Ion, thank you for that, I see....
1. Can I ask what mechanism you would suggest for notifying the other
processes to disconnect before the grow() operation?
2. Considering how to deal with the issue of dynamically growing a
shared memory vector where there is one producer process and several
consumers; I hit upon the notion of having the producer process use a
std::vector to conventionally store data and then using a boost shared
memory segment to store a pointer to the std::vector. Consumer processes
would access the boost shared memory to retrieve the pointer value thus
enabling access to the std::vector data store in the producer process.
This, I hoped, might remove the complexities associated with dynamically
growing a shared memory segment? The big question is: would it work? Would
this be a valid means of interprocess communication? Or fraught with
complexities?
Thanks,
Riskybiz.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net