The reason for this is that msvc didn't support this until 2015.   I'm fine with these changes but i think you guys still need 2013 for a while longer, right?<br><div class="gmail_quote"><div dir="ltr">On Mon, Feb 29, 2016 at 3:38 AM Pavel Labath <<a href="mailto:labath@google.com">labath@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">labath created this revision.<br>
labath added reviewers: clayborg, zturner.<br>
labath added a subscriber: lldb-commits.<br>
<br>
"Initialization of function-local statics is guaranteed to occur only once even when called from<br>
multiple threads, and may be more efficient than the equivalent code using std::call_once."<br>
<<a href="http://en.cppreference.com/w/cpp/thread/call_once" rel="noreferrer" target="_blank">http://en.cppreference.com/w/cpp/thread/call_once</a>><br>
<br>
I'd add that it's also more readable.<br>
<br>
<a href="http://reviews.llvm.org/D17710" rel="noreferrer" target="_blank">http://reviews.llvm.org/D17710</a><br>
<br>
Files:<br>
  source/Target/Process.cpp<br>
  source/Target/Target.cpp<br>
  source/Target/Thread.cpp<br>
<br>
Index: source/Target/Thread.cpp<br>
===================================================================<br>
--- source/Target/Thread.cpp<br>
+++ source/Target/Thread.cpp<br>
@@ -61,11 +61,7 @@<br>
 {<br>
     // NOTE: intentional leak so we don't crash if global destructor chain gets<br>
     // called as other threads still use the result of this function<br>
-    static ThreadPropertiesSP *g_settings_sp_ptr = nullptr;<br>
-    static std::once_flag g_once_flag;<br>
-    std::call_once(g_once_flag,  []() {<br>
-        g_settings_sp_ptr = new ThreadPropertiesSP(new ThreadProperties (true));<br>
-    });<br>
+    static ThreadPropertiesSP *g_settings_sp_ptr = new ThreadPropertiesSP(new ThreadProperties (true));<br>
     return *g_settings_sp_ptr;<br>
 }<br>
<br>
Index: source/Target/Target.cpp<br>
===================================================================<br>
--- source/Target/Target.cpp<br>
+++ source/Target/Target.cpp<br>
@@ -2780,11 +2780,7 @@<br>
 {<br>
     // NOTE: intentional leak so we don't crash if global destructor chain gets<br>
     // called as other threads still use the result of this function<br>
-    static TargetPropertiesSP *g_settings_sp_ptr = nullptr;<br>
-    static std::once_flag g_once_flag;<br>
-    std::call_once(g_once_flag,  []() {<br>
-        g_settings_sp_ptr = new TargetPropertiesSP(new TargetProperties(nullptr));<br>
-    });<br>
+    static TargetPropertiesSP *g_settings_sp_ptr = new TargetPropertiesSP(new TargetProperties(nullptr));<br>
     return *g_settings_sp_ptr;<br>
 }<br>
<br>
Index: source/Target/Process.cpp<br>
===================================================================<br>
--- source/Target/Process.cpp<br>
+++ source/Target/Process.cpp<br>
@@ -835,11 +835,7 @@<br>
 {<br>
     // NOTE: intentional leak so we don't crash if global destructor chain gets<br>
     // called as other threads still use the result of this function<br>
-    static ProcessPropertiesSP *g_settings_sp_ptr = nullptr;<br>
-    static std::once_flag g_once_flag;<br>
-    std::call_once(g_once_flag,  []() {<br>
-        g_settings_sp_ptr = new ProcessPropertiesSP(new ProcessProperties (NULL));<br>
-    });<br>
+    static ProcessPropertiesSP *g_settings_sp_ptr = new ProcessPropertiesSP(new ProcessProperties (NULL));<br>
     return *g_settings_sp_ptr;<br>
 }<br>
<br>
<br>
<br>
</blockquote></div>