Subject: Re: [boost] [interprocess] locked mutex and process killed
From: Vicente Botet Escriba (vicente.botet_at_[hidden])
Date: 2009-03-24 12:39:08
Edouard A. wrote:
> On Mon, 23 Mar 2009 23:57:19 +0100, "vicente.botet"
> <vicente.botet_at_[hidden]> wrote:
>> 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
> 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. ;)
> Unsubscribe & other changes:
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
-- View this message in context: http://www.nabble.com/-interprocess--locked-mutex-and-process-killed-tp22671125p22684456.html Sent from the Boost - Dev mailing list archive at Nabble.com.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk