Boost logo

Boost :

Subject: Re: [boost] [interprocess] locked mutex and process killed
From: Vicente Botet Escriba (vicente.botet_at_[hidden])
Date: 2009-03-24 13:34:58


Edouard A. wrote:
>
> On Tue, 24 Mar 2009 09:39:08 -0700 (PDT), Vicente Botet Escriba
> <vicente.botet_at_[hidden]> wrote:
>
>> 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?
>
> Hi Vicente,
>
> If the process is killed by the operating system (or the user with
> SIGKILL/TerminateProcess) there is nothing you can do before dying
> (otherwise that means you could make a process immortal).
>
> For mutexes they will be unlocked when leaving the scope of your function,
> so if you have some sort of exception translator you should be on the safe
> side even for division by zero, bad memory access and the like (in Windows
> I'm thinking about _set_se_translator). A lot of low memory errors will
> also be caught thanks to std::bad_alloc.
>
> For other resources it may make sense to register a clean up function with
> atexit.
>
> Kind regards.
>
> --
>
> EA
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
>

How the mutex will be unlocked when leaving the scope of the function?

Vicente

-- 
View this message in context: http://www.nabble.com/-interprocess--locked-mutex-and-process-killed-tp22671125p22685305.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