Re: [Boost-users] What is the best idiom for using call_once ?

18 Nov
2012
18 Nov
'12
11:42 a.m.
Date: Sat, 17 Nov 2012 13:51:48 +0100 From: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
http://stackoverflow.com/questions/12302057/c11-safe-double-checked-locking-...
This points out that under C++11 rules, static locals are thread safe for the first-time initialization. That explains why there is no fancy construct for doing so; it's just there! Nice. Or it will be, some day. I looked at the code generated by Microsoft VS2010 and it does not give this feature, alas. It does tell me though that a compatibility construct like I'm looking for ought to expand into a plain static local for compilers that do work that way; just let the compiler do it. All the more reason to abstract the issue for current uses! —John
4573
Age (days ago)
4573
Last active (days ago)
0 comments
1 participants
participants (1)
-
John M. Dlugosz