Boost logo

Boost Users :

Subject: Re: [Boost-users] [interprocess] access dynamically accessed shared region in another process
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2009-04-01 12:58:39


Casimiro, Daniel C CIV NUWC NWPT wrote:
>> To do this, I first create a shared segment and then a
>> dynamic area in it. like this:
>>
>> struct transfer_buffer {
>> void *buf;
>> size_t bufsize;
>> boost::interprocess::interprocess_mutex mutex;
>> size_t dmember;
>> }
>
> I only quickly looked at your code, but I think that your void* pointer is
> invalid in the second process.
>
> Take a look at boost::interprocess::offset_ptr and use it in place of void*.
>
> ~Dan

Thanks for the quick reply, Dan. Yes, all pointers placed in shared
memory should be offset_ptr as explained here:

http://www.boost.org/doc/libs/1_38_0/doc/html/interprocess/sharedmemorybetweenprocesses.html#interprocess.sharedmemorybetweenprocesses.mapped_region_object_limitations

Regards,

Ion


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