
24 Mar
2009
24 Mar
'09
10:08 a.m.
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