Boost logo

Boost Users :

Subject: Re: [Boost-users] [interprocess] Interprocess mutex not working / throwing exception when trying to write lock
From: Malko (malko.bravi_at_[hidden])
Date: 2015-10-16 04:44:14


Try running your two programs at the same time.
Due to the fact that you are unlocking immediately after locking (my
previous post #1), if you start the two programs at the same time you do not
have issues, because the 2nd program completes before the 1st.

The 2nd program will crash only if he tries to access the mutex after the
1st program completes, because you destroy the mutex at the end of program
1.

Since program 1 creates the mutex, it must start before program 2. Due to
the fact that your program 2 is supposed to end after (from what I see), I
would suggest moving

seg->destroy<SharedMemData>("TrackOutput");

to the end of the 2nd program.

Mind thought that you also need to correct the issue with locking I
mentioned in #1 of my previous post, or now it will be program 1 the one
crashing.

--
View this message in context: http://boost.2283326.n4.nabble.com/interprocess-Interprocess-mutex-not-working-throwing-exception-when-trying-to-write-lock-tp4680985p4681002.html
Sent from the Boost - Users mailing list archive at Nabble.com.

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