|
Boost Users : |
From: Sunil Chomal (sjchomal_at_[hidden])
Date: 2007-03-23 01:15:16
Dear All,
As suggested in an earlier post, for using the interprocess allocator with
STL container, one has to use the fixed_managed_shared_memory. To be able to
do so, we have to specify an address at which the shared memory region is
mapped. This address is passed as the last argument to the
fixed_managed_shared_memory constructor, and after this the following is the
sequence of calls:
1) fixed_managed_shared_memory(,,,,addr)
2) basic_managed_shared_memory(,,,,addr)
3) managed_open_or_create_impl(,,,,addr,,)
4) priv_open_or_create(,,,,addr,)
In priv_open_or_create() one creates the mapped_region which in turn calls
mmap() to map the shared memory to the addr specified by us. However the
mapped_region object that is created here is as follows:
mapped_region region(dev, read_write);
here the address is not passed to the to the mapped_region constructor,
which has default arguments for addr which is '0'. Hence, the
fixed_managed_shared_memory is never allocated at the addr specified.
Can someone help with this?
A work around that I have done is to create the mapped_region as follows:
mapped_region region(dev, read_write, 0, 0, addr);
Regards,
Sunil Chomal
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