From: Michael Glassford (glassfordm_at_[hidden])
Date: 2003-12-16 11:32:26
Alexander Terekhov wrote:
> Peter Dimov wrote:
>>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,
Actually, I meant the pthread implementation of Boost.Thread, which does
need to deal with exceptions, and looks like this:
void call_once(void (*func)(), once_flag& flag)
> Except that
> The pthread_once() function is not a cancellation point. However,
> if init_routine is a cancellation point and is canceled, the effect
> on once_control shall be as if pthread_once() was never called.
I did run across the above quote after reading Peter's reply above. In
C++, does "if init_routine is a cancellation point and is canceled"
roughly translate into "if init_routine throws an exception"? I confess
to almost complete ignorance of pthreads (what little I know I've picked
up by following conversations here and occasionally in
comp.programming.threads), so in addition to a reply to my question, I'd
appreciate pointers to a good tutorial and/or reference.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk