Boost logo

Boost :

From: Greer, Joe (jgreer_at_[hidden])
Date: 2005-09-08 10:23:39

I have continued to think about the call_once() mechanism because many
uses I can think of for it could require that it be called a lot.
Therefore, I think we want the "normal" path to be as quick as possible.
To that end, I was trying to come up with a way to use critical sections
instead of named semaphores for the guard. I think I have managed that
now, but it also occurs to me that we can test the flag up front to see
if it has been set and if it has, we don't need to get any sort of
guard. In the case that it hasn't, we can then acquire a guard (of some
sort), re-test the flag (in case we have two threads running in
parallel), and then execute the function. It looks a little uglier
because of the double test, but it would execute faster because most of
the time it would never have to get the guard. Hopefully there is
something useful here. :)


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