Boost logo

Boost :

From: Jason Hise (chaos_at_[hidden])
Date: 2005-09-13 10:39:04

John Maddock wrote:

>The mutex is unique to both the calling process and the call_once flag, but
>not the function pointer (however there should always be a one to one
>correspondence between the once-flag and the function pointer).
I should probably elaborate on my problem a little bit more. I wanted
to create a function that makes a given call atomic, but doesn't enforce
that the function be called only once. I thought I could do so by using
a once_flag allocated on the stack immediately before invoking
call_once, so the flag would always be reinitialized to BOOST_ONCE_INIT
and call_once could just offer me it's atomic guarantees, but apparently
that won't work. I guess I'll just have to find some place to put my
own mutex where it can be constructed safely.


Boost list run by bdawes at, gregod at, cpdaniel at, john at