Boost logo

Boost :

From: scleary_at_[hidden]
Date: 2001-11-14 08:38:28


> From: williamkempf_at_[hidden] [mailto:williamkempf_at_[hidden]]
>
> --- In boost_at_y..., scleary_at_j... wrote:
> > My current singleton would look very different once I remove that
> > restriction (by using an exception-neutral equivalent of
boost::call_once).
> > We might just want to start from scratch.
>
> What do you mean by "an exception-neutral equivalent of
> boost::call_once"? Is this something Boost.Threads needs to look at?

I'm using the term "exception-neutral" meaning that: for library code that
calls end-user functions, if those functions throw, the library is still in
a usable state.

The reason: I'd like to allow singleton constructors to throw. At least in
my code, most of my singleton constructors can fail.

Making boost::call_once exception-neutral for Win32 is simple enough; but
I'm not too sure about the Posix side of things; it just depends on whether
or not the pthread_once is exception-neutral. In addition to being
exception-neutral, I think call_once/pthread_once must agree not to set the
flag if an exception is thrown from the user function.

I think it might be useful to Boost.Threads -- but you might want to just
add it as a separate function, since its implementation may be less
efficient by-hand if we can't use pthread_once.

        -Steve


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