Boost logo

Boost Users :

Subject: Re: [Boost-users] Creating interprocess::shared_ptr across processes
From: Viatcheslav.Sysoltsev_at_[hidden]
Date: 2011-04-18 03:18:39


On Mon, 18 Apr 2011 05:10:36 +0200, GxL <gabriel.levy_at_[hidden]>
wrote:

> Hi all,
>
> I've been looking into the "boost::interprocess" library to use shared
> memory
> the resides in a non-paged physical memory facilitated by RTX (Real-time
> Windows extension). According to my understanding it's best to use
> "managed_external_buffer".
> I have managed to create the shared memory and create and share objects
> using
> raw pointers.
> I would however prefer using smart_ptr that is offered by the
> boost::interprocess.
>

When process dies unexpectedly nobody guarantees your destructors are
called, but shared memory remains - this alone should let you rethink your
idea. As a rule of thumb I'd advise placing only plain POD-composed
structures in shared memory and never rely on the state of the shared
memory on startup before some kind of handshake with the counterparts.

-- Slava


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