Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-09-02 02:06:42


Anthony Williams wrote:
> Also, the semaphore version runs the function once, even if it
> throws an exception. The mutex version runs the function repeatedly
> if it throws an exception. The docs say that the function isn't
> allowed to throw, so this is a moot point.

I like the signature of call_once:

    template<typename Function>
    void call_once(Function f, once_flag& flag)

but you need to fix the above behavior. The function is considered "run"
only when it returns without an exception. So your semaphore version runs it
zero times when an exception is thrown.


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