Boost logo

Boost Users :

From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2006-10-17 01:04:03


Hi,

> 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-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