Subject: Re: [boost] Boost sprint: #3407 boost::call_once not re-entrant (atleast in win32)
From: Francois Barel (frabar666_at_[hidden])
Date: 2009-11-23 09:45:00
Anthony Williams wrote:
> The current implementation handles exceptions "properly" in the sense
> that if the once function exits with an exception then it is not marked
> as called and another thread (possibly one of those waiting) will call
Does this mean the function will be called again? Isn't that
disturbing for something named "call_once"?
> The suggestion is to optionally have the function marked as called even
> if an exception is thrown. I don't think this is worthwhile.
The behavior I would expect instead is: if the function throws an
exception, (an internal flag is set, and) other "call_once" calls will
also throw an exception immediately, without calling the function
Ideally (for me) the exception would be the one thrown by the function
when it was called (i.e. the exception object would be caught and
stored during the first "call_once" call, and then thrown again in
other "call_once" calls) -- but I could live with other "call_once"
calls throwing a system exception (something like
I imagine some people will prefer the current behavior (and I guess it
has to stay for compatibility's sake anyway), so maybe the two should
be available somehow (new flag, policy or new function)?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk