<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I already checked in a fix (or at least I think I did - the commit emails have been trickling in quite slowly lately)</div><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 16, 2014, at 11:16 AM, Zachary Turner <<a href="mailto:zturner@google.com" class="">zturner@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">Heh, interesting.  Didn't know that.  I will change to #include and check it in, thanks for the explanation of why it worked.<br class=""><br class=""><div class="gmail_quote">On Tue Dec 16 2014 at 11:10:20 AM Enrico Granata <<a href="mailto:egranata@apple.com" class="">egranata@apple.com</a>> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class="">It says #import because of my silly brain, actually</div><div class="">And, yes, it compiles on OS X - clang is quite happy to oblige ObjC directives even if it’s not ObjC code</div></div><div style="word-wrap:break-word" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 16, 2014, at 11:03 AM, Zachary Turner <<a href="mailto:zturner@google.com" target="_blank" class="">zturner@google.com</a>> wrote:</div><br class=""><div class="">Why does this say #import instead of #include?  Does this actually compile on MacOSX?  I'm assuming it's just a typo for #include, but I'm curious why this ever worked at all on any platform.<br class=""><br class=""><div class="gmail_quote">On Mon Dec 15 2014 at 8:34:14 PM Enrico Granata <<a href="mailto:egranata@apple.com" target="_blank" class="">egranata@apple.com</a>> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: enrico<br class="">
Date: Mon Dec 15 20:34:13 2014<br class="">
New Revision: 224310<br class="">
<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=224310&view=rev" target="_blank" class="">http://llvm.org/viewvc/llvm-<u class=""></u>project?rev=224310&view=rev</a><br class="">
Log:<br class="">
Instead of rolling our own, use the C++11 sanctioned solution<br class="">
<br class="">
Modified:<br class="">
    lldb/trunk/source/Core/<u class=""></u>ConstString.cpp<br class="">
<br class="">
Modified: lldb/trunk/source/Core/<u class=""></u>ConstString.cpp<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ConstString.cpp?rev=224310&r1=224309&r2=224310&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-<u class=""></u>project/lldb/trunk/source/<u class=""></u>Core/ConstString.cpp?rev=<u class=""></u>224310&r1=224309&r2=224310&<u class=""></u>view=diff</a><br class="">
==============================<u class=""></u>==============================<u class=""></u>==================<br class="">
--- lldb/trunk/source/Core/<u class=""></u>ConstString.cpp (original)<br class="">
+++ lldb/trunk/source/Core/<u class=""></u>ConstString.cpp Mon Dec 15 20:34:13 2014<br class="">
@@ -11,6 +11,8 @@<br class="">
 #include "lldb/Host/Mutex.h"<br class="">
 #include "llvm/ADT/StringMap.h"<br class="">
<br class="">
+#import <mutex><br class="">
+<br class="">
 using namespace lldb_private;<br class="">
<br class="">
<br class="">
@@ -184,25 +186,16 @@ protected:<br class="">
 // we can't guarantee that some objects won't get destroyed after the<br class="">
 // global destructor chain is run, and trying to make sure no destructors<br class="">
 // touch ConstStrings is difficult.  So we leak the pool instead.<br class="">
-//<br class="">
-// FIXME: If we are going to keep it this way we should come up with some<br class="">
-// abstraction to "pthread_once" so we don't have to check the pointer<br class="">
-// every time.<br class="">
 //----------------------------<u class=""></u>------------------------------<u class=""></u>------------<br class="">
 static Pool &<br class="">
 StringPool()<br class="">
 {<br class="">
-    static Mutex g_pool_initialization_mutex;<br class="">
+    static std::once_flag g_pool_initialization_flag;<br class="">
     static Pool *g_string_pool = NULL;<br class="">
<br class="">
-    if (g_string_pool == NULL)<br class="">
-    {<br class="">
-        Mutex::Locker initialization_locker(g_pool_<u class=""></u>initialization_mutex);<br class="">
-        if (g_string_pool == NULL)<br class="">
-        {<br class="">
-            g_string_pool = new Pool();<br class="">
-        }<br class="">
-    }<br class="">
+    std::call_once(g_pool_<u class=""></u>initialization_flag, [] () {<br class="">
+        g_string_pool = new Pool();<br class="">
+    });<br class="">
<br class="">
     return *g_string_pool;<br class="">
 }<br class="">
<br class="">
<br class="">
______________________________<u class=""></u>_________________<br class="">
lldb-commits mailing list<br class="">
<a href="mailto:lldb-commits@cs.uiuc.edu" target="_blank" class="">lldb-commits@cs.uiuc.edu</a><br class="">
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits" target="_blank" class="">http://lists.cs.uiuc.edu/<u class=""></u>mailman/listinfo/lldb-commits</a><br class="">
</blockquote></div>
</div></blockquote></div><br class=""></div><div style="word-wrap:break-word" class=""><div class="">
<div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class=""><div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class=""><div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class=""><div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class=""><div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class=""><div class="">Thanks,</div><div class=""><i class="">- Enrico</i><br class="">📩 egranata@<font color="#ff2600" class=""></font>.com ☎️ 27683</div><div class=""><br class=""></div></div></div></div></div></div><br class=""><br class="">
</div>
<br class=""></div></blockquote></div>
</div></blockquote></div><br class=""><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Thanks,</div><div class=""><i class="">- Enrico</i><br class="">📩 egranata@<font color="#ff2600" class=""></font>.com ☎️ 27683</div><div class=""><br class=""></div></div></div></div></div></div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<br class=""></body></html>