Boost logo

Boost :

From: Glenn Schrader (gschrad_at_[hidden])
Date: 2007-09-25 16:03:42


Well, I hacked up a version that used status flags to return the open
failure rather than an exception and it works find. Of course if there
ever was any out-of-memory condition (etc) then it would just terminate
but I view that as just part of the contract you get when you turn
exceptions off then use an API that might throw. In practice this level
of functionality is usable. On a more philosophical note, I don't think
that exceptions are the "right" way to implement this. Exceptions are
best used to signal exceptional conditions and not as a way to control
normal program flow. An open failure, rather than being exceptional, is
the most commonly expected case since only one process will actually not
throw. My $0.02.

-glenn

Ion Gaztañaga wrote:
> Glenn Schrader wrote:
>
>> Ion,
>>
>> I've run across an issue in the shared memory initialization sequence.
>> In managed_open_or_create_impl.hpp at around line 291 there is a a try /
>> catch that detects if creating a shared memory segment fails due to it
>> already existing. This fails to work for programs compiled without
>> exceptions. What happens is that any thrown exception causes an
>> immediate program exit so the try / catch handler never gets a chance to
>> act.
>>
>> Glenn Schrader - MITLL
>> _______________________________________________
>> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>>
>
> For the moment, Interprocess does not support programs compiled without
> exceptions. The issue is hard to solve, because we need to handle memory
> exhaustion issues on all shared memory containers, and there is no
> standard interface for that.
>
> I have plans to investigate how could I change Interprocess so that it
> can be used with no exceptions. I would need to start offering
> non-throwing alternatives in all constructors and maybe some hooks on
> STL-like allocators to handle memory exhaustion issues. But I'm afraid
> this effort won't be soon, because I'm buried on several issues.
>
> If you have any suggestion to make Interprocess compatible with no
> exceptions, let me know.
>
> Regards,
>
> Ion
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
>
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk