Boost logo

Boost :

From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2006-10-17 11:20:18


Hi,

> Ion,
>
> I don't know if I'm just missing it or if this feature doesn't exist, but is
> there a feature in interprocess to check that a segment exists prior to
> attempting to find or construct a variable in that segment? If it doesn't
> exist this would be an extremely useful feature so that when an application
> goes to create an object in shared memory where the shared memory segment
> has not been created the program doesn't just segfault but gives the
> application at least a small chance of exiting gracefully (i.e. a thrown
> exception).

If you hold a reference to a managed_shared_memory the segment always
exists, since in Interprocess, the processes is detached from the
segment in the destructor of the managed_shared_memory. This is
different from Shmem, where you could call "close()". No other processes
can destroy the segment while you have a opened/created
managed_shared_memory. At best, in UNIX, it will unlink it, so new
processes won't be able to find it, but old processes attached to the
segment will continue working fine.

I don't know if I have responded correctly to your question, so could
you show me an example of what do you want to achieve?

Regards,

Ion


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk