Boost Users :
Subject: Re: [Boost-users] [interprocess] mutex in shared memory, crash recovery
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2009-12-31 04:38:57
El 30/12/2009 2:11, Jerry Hicks escribió:
> I know the correct answer is to avoid crashing while holding a mutex in
> shared memory ;-)
In theory in some POSIX platforms you have robust mutexes, which notify
if the process holding the mutex has died, but obviously this is not
portable (specially for windows). However, supporting robust mutexes
requires interface changes (posix returns an error indicating that the
mutex was abandoned and you have an option to fix it or not) that need
some careful thinking. One of the projects for the next year is to add
support for robust mutexes and even a decent emulation of them in
platforms that don't support them.
> But since I'm handing a system off to other developers I'd like to understand
> if there is a most correct way to 'scrub' a mutex in shared memory clean if
> a thread crashed while holding the mutex.
> Assume that at the point I would like to do this that there is only one
> thread attached to the shared memory and no possibility of any thread
> attempting to lock the (locked stagnant) mutex.
Currently, that might be the best option.
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