Boost logo

Boost Users :

Subject: Re: [Boost-users] [interprocess] Checking for existence Named Mutex
From: Brian Davis (bitminer_at_[hidden])
Date: 2010-08-24 17:56:53

> How do I check for the existence of a named resource in using boost
>> interprocess without wrapping a open_only in a try catch block and
>> waiting for the exception?
> That's the only way.
Well you know that they say.... if first you don't succeed try... catch
again. I sure hope that this is not standard coding practices for
Boost.Interprocess. I have seen this before in the likes of Borland Builder
(VCL) and Java and I consider this to be poor programming practices. I
realize that boost is working to create a standard library to mirror the
likes of Java... I just hope Boost does not mirror(copy) the bad practices
as well. I hope this gets fixed in future releases.

The logic here is to see if a named mutex is in existence (checking to see
if process is running) if not launch the app that will create it (auto
launch the app). Then take the mutex and do some stuff then release. This
results in a try.. catch... fail.. try ... catch succeed. I have tested
this and it works however sloppy it may be.

Strange how objects created with in a shared memory region can be searched
for, but not the shared memroy region itself or named mutexes.

--snip from boost.interporcess documentatoin--
 //Find the array
 res = segment.find<MyType> ("MyType array");
--end snip--

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at