Boost logo

Boost Users :

Subject: Re: [Boost-users] mixed 32bit and 64bit shared memory
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2013-01-11 06:20:01


El 11/01/2013 5:40, Dave Dyer escribió:
>
> I see notes about boost supporting "customizing offset_ptr" to
> support shared memory where both 64 bit and 32 bit processes
> are sharing the memory, but I don't see a specific example of
> how to do that. It seems that "out of box" it doesn't work.

It's not trivial, and it's still experimental. It might not work at all
in your platform as Inteprocess depends on other libraries (like pthread
mutexes) that can be incompatible between 32 and 64 bit applications.
E.g. pthread_mutex_t from glibc can't be shared between 32 bit and 64
bit applications.

You need to define an offset_ptr with 64 bit OffsetType

typedef offset_ptr<T, std::ptrdiff_t, unsigned long long> my_offset_ptr;

and instantiate all interprocess managed resources like
(basic_managed_shared_memory) like this:

typedef basic_managed_shared_memory
    <char
    ,rbtree_best_fit<mutex_family, my_offset_ptr>
    ,iset_index>
managed_shared_memory;

Again, this is not supported and it's still experimental.

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