|
Boost Users : |
Subject: Re: [Boost-users] [interprocess] access dynamically accessed shared region in another process
From: Stephan Menzel (stephan.menzel_at_[hidden])
Date: 2009-04-01 14:40:11
Am Mittwoch, 1. April 2009 18:58:39 schrieb Ion Gaztañaga:
>
> 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/sharedmemorybetw
>eenprocesses.html#interprocess.sharedmemorybetweenprocesses.mapped_region_ob
>ject_limitations
Thanks for the quick reply!
Meanwhile I suspected as much, but didn't know for sure how to interpret the
docs.
Also, this alignment check taken from the docs doesn't compile anymore with a
pointer type as such:
struct transfer_buffer {
boost::interprocess::offset_ptr<void> buf;
size_t bufsize;
};
...
ret->bufsize = SIZE;
ret->buf = seg->allocate_aligned(ret->bufsize, Alignment);
// Check alignment
assert((static_cast<void *>(ret->buf) - static_cast<void *>(0)) % Alignment ==
0);
The assert gives me:
/home/sm/devel/rtssvn/cpp/librender/Render.cpp:109: Erro: invalid static_cast
of type »boost::interprocess::offset_ptr<void>« into type »void*«
Is that assert actually neccessary? I wouldn't know what to do in case of a
failure anyway.... Performance accessing the buffer matters a lot though.
Cheers,
Stephan
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