From: Ryan, Paul L. (PAUL.L.RYAN_at_[hidden])
Date: 2006-10-17 11:44:08
I don't think that quite answers my question (but maybe it does) a simple
example of what I would like to be able to do is:
if(shm.isInitialized()) // This functionality would be nice
catch(interprocess_initialized e) // This functionality is also ok
Again thanks for your assistance.
SAIC - Tactical Systems
From: igaztanaga_at_[hidden] [mailto:igaztanaga_at_[hidden]]
Sent: Tuesday, October 17, 2006 9:20 AM
To: boost_at_[hidden]; Ryan, Paul L.
Subject: Re: [interprocess] Segment existance check
> 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?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk