Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.Interprocess: Can I share the multi_index array between processes?
From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2010-04-06 14:59:57


arm2arm <arm2arm <at> gmail.com> writes:
>
>
> Hello,
> I would like to load multiindex container by one process lets say
> serverside_loader. And access that array by another clientside_analyser
> process? How to do that?

Hi Arman,

Yes, this can be done. There's an example that shows you how
to do it:

http://www.boost.org/libs/multi_index/doc/examples.html#example12

Basically, you've got to take care of three things:

* The element type (particleID in this case) must be placeable
in shared memory, see

http://tinyurl.com/ygau74j

for info on the limitations imposed on such objects. particleID
is a simple class and can be directly put in shared memory.
* You must use a special Boost.Interprocess allocator for
the multi-index container. Use the aforementioned example as
a guide.
* Access to the container must be properly synchronized, just
as you'd do for instance in a multi-threaded program.

Good luck with your project, come back if you have some
difficulty.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


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