
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 semanitics.
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(). Roland