Boost logo

Boost :

From: Roland Schwarz (roland.schwarz_at_[hidden])
Date: 2006-10-06 06:32:23

John Maddock wrote:
> ... but I did notice that you needed two calls to
> call_once? One of the gripes I've had about call_once was that it was
> rather a heavyweight call: is this still the case?

Hmm, the once it has been running it does a simple
     if (compare_exchange(&flag, 1, 1) == 0)
and returns. At least on windows I do not expect much overhead. Does
this address your question? Also this is implementation specific, and
might be optimized later. My main question was about interface and

> Do you have any feeling
> for how efficient this approach is compared to say a statically initialised
> mutex (assuming that's what you want) ?

If you mean boost/regex/pending/static_mutex.hpp, I would say it is the
same. If you compare it to Broneks wrapper the comparison is not really
appropriate, since that approach does initialization on application
start up before main().


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