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?