Boost logo

Boost :

Subject: Re: [boost] [interprocess] locked mutex and process killed
From: Edouard A. (edouard_at_[hidden])
Date: 2009-03-24 12:58:20

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

Kind regards.


Boost list run by bdawes at, gregod at, cpdaniel at, john at