
Edouard A. wrote:
On Mon, 23 Mar 2009 23:57:19 +0100, "vicente.botet" <vicente.botet@wanadoo.fr> wrote:
Hi,
what happens when a process owning interprocess::mutex is killed? is the mutex unlocked before the process dies?
After a quick look at the source code:
inline void interprocess_mutex::lock() { if (pthread_mutex_lock(&m_mut) != 0) throw lock_exception(); }
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. ;)
--
EA _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Hi, 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? Vicente -- View this message in context: http://www.nabble.com/-interprocess--locked-mutex-and-process-killed-tp22671... Sent from the Boost - Dev mailing list archive at Nabble.com.