Hello, My question is with regard to named_mutexes that are abandoned by a process that dies abnormally. Essentially I have shared memory( utilizing boost shared memory libraries ) and am incorporating boost named mutexes to limit access to one process at a time. There is no concept of a server/client or parent/child process....the process have equal opportunity. This is Microsoft centric code that I am required to support cross-platforms( Unix-like). Microsoft's mutexes have the concept of a mutex object being abandoned if the thread terminates without releasing. Is there any support in the boost mutex to determine if the mutex has been abandoned? Option: What I am considering is perhaps before the mutex is locked, it check a file that has been created with the mutex name and the pid of the process that has it locked. If the process does not exisit the file the mutex is unlocked and the file entry is removed and the new process id is entered. I am not sure if there is a chance of a race condition I would have to scope it out. FYI - I am using 1.41. is there any changes in 1.42 ( i will be checking ). Any other suggestions? Carla Strembicke Software Developer [cid:imagea03ff0.jpg@eeae924c.570740bf] SUBNET Solutions Inc. www.SUBNET.comhttp://www.subnet.com/ Making Substations More Intelligent T: 403.270.8885 F: 403.270.9631 #100, 4639 Manhattan Road SE, Calgary, Alberta, Canada; T2G 4B3 Follow SUBNET: Twitterhttp://twitter.com/subnetsolutions | Facebookhttp://www.facebook.com/subnetsolutions | Linkedlnhttp://www.linkedin.com/groups?gid=2733031&trk=hb_side_g Visit the all new SUBNET website at http://www.SUBNET.comhttp://www.subnet.com/ CONFIDENTIAL INFORMATION NOTICE: The information contained in this e-mail is privileged, confidential and intended solely for the use of the addressee named above. If the reader of this e-mail is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this e-mail is strictly prohibited. If you received this in error, please contact the sender and destroy all copies of this e-mail. Thank you.
On Feb 11, 2010, at 5:11 PM, Carla Strembicke wrote:
My question is with regard to named_mutexes that are abandoned by a process that dies abnormally.
Is there any support in the boost mutex to determine if the mutex has been abandoned?
I think not yet, though this has been discussed in the past.
Any other suggestions?
What you want is called a "robust" mutex in the Unix world; search for pthread_mutexattr_setrobust and pthread_mutex_consistent. Reasonably recent versions of Linux have them (kernel support showed up in 2.6.17or18, I forget which). Some other Unix variants also support them (I think they may have been around in Sun variants for quite a while, for example).
What about the named_semaphore? Is it able to recover if the process dies abnormally? -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Kim Barrett Sent: February-11-10 4:29 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] abandoned named_mutex On Feb 11, 2010, at 5:11 PM, Carla Strembicke wrote:
My question is with regard to named_mutexes that are abandoned by a process that dies abnormally.
Is there any support in the boost mutex to determine if the mutex has been abandoned?
I think not yet, though this has been discussed in the past.
Any other suggestions?
What you want is called a "robust" mutex in the Unix world; search for pthread_mutexattr_setrobust and pthread_mutex_consistent. Reasonably recent versions of Linux have them (kernel support showed up in 2.6.17or18, I forget which). Some other Unix variants also support them (I think they may have been around in Sun variants for quite a while, for example). _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Carla Strembicke
-
Kim Barrett