
Vicente Botet Escriba wrote:
Edouard A. wrote:
The answer to your question is "an exception will be thrown" since the call will return "EOWNERDEAD".
Generally speaking when a thread terminates while holding a mutex, the mutex is considered abandoned and shared resources protected by the mutex are in an undetermined state. Hope you like quantum physics. ;)
if this is the case, what do you think about adding a kind of resource manager that will ensure all the shared resources are released (and in particular the interprocess::mutex are unlocked) on a cleanup phase just before diing?
There is no guarantee at all. POSIX does not guarantee EOWNERDEAD if you don't use robust mutexes, which is now an option in POSIX 2008 (O'll try to add it ASAP but adding robust mutexes has some interface problems) but is not mandatory. Adding a resource manager is not trivial, it needs to periodically check if processes are alive and that's not easy. Interprocess does not offer any guarantee that the underlying OS does not offer. Best, Ion