|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-12-16 09:18:17
Michael Glassford wrote:
>
> One other potential problem that needs to be addressed in the same
> section of code: if the "called once" function throws an exception,
> should the flag indicating that it has been called be set or not? If the
> flag is set, the function will not be called again even though it
> failed; on the other hand, if the flag is is not set, the function may
> continue to be called and continue to throw an exception. What does
> the pthread implementation do in this case?
Pthreads don't need to deal with exceptions, but in:
void f()
{
static X x;
}
if X::X() throws, the initialization will be attempted again when f() is
entered for a second time. call_once should do the same, i.e. not set the
flag on exception.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk