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><br><div class="gmail_quote">On Mon Dec 15 2014 at 8:34:14 PM Enrico Granata <<a href="mailto:egranata@apple.com">egranata@apple.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: enrico<br>
Date: Mon Dec 15 20:34:13 2014<br>
New Revision: 224310<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=224310&view=rev" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project?rev=224310&view=rev</a><br>
Log:<br>
Instead of rolling our own, use the C++11 sanctioned solution<br>
<br>
Modified:<br>
lldb/trunk/source/Core/<u></u>ConstString.cpp<br>
<br>
Modified: lldb/trunk/source/Core/<u></u>ConstString.cpp<br>
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">http://llvm.org/viewvc/llvm-<u></u>project/lldb/trunk/source/<u></u>Core/ConstString.cpp?rev=<u></u>224310&r1=224309&r2=224310&<u></u>view=diff</a><br>
==============================<u></u>==============================<u></u>==================<br>
--- lldb/trunk/source/Core/<u></u>ConstString.cpp (original)<br>
+++ lldb/trunk/source/Core/<u></u>ConstString.cpp Mon Dec 15 20:34:13 2014<br>
@@ -11,6 +11,8 @@<br>
#include "lldb/Host/Mutex.h"<br>
#include "llvm/ADT/StringMap.h"<br>
<br>
+#import <mutex><br>
+<br>
using namespace lldb_private;<br>
<br>
<br>
@@ -184,25 +186,16 @@ protected:<br>
// we can't guarantee that some objects won't get destroyed after the<br>
// global destructor chain is run, and trying to make sure no destructors<br>
// touch ConstStrings is difficult. So we leak the pool instead.<br>
-//<br>
-// FIXME: If we are going to keep it this way we should come up with some<br>
-// abstraction to "pthread_once" so we don't have to check the pointer<br>
-// every time.<br>
//----------------------------<u></u>------------------------------<u></u>------------<br>
static Pool &<br>
StringPool()<br>
{<br>
- static Mutex g_pool_initialization_mutex;<br>
+ static std::once_flag g_pool_initialization_flag;<br>
static Pool *g_string_pool = NULL;<br>
<br>
- if (g_string_pool == NULL)<br>
- {<br>
- Mutex::Locker initialization_locker(g_pool_<u></u>initialization_mutex);<br>
- if (g_string_pool == NULL)<br>
- {<br>
- g_string_pool = new Pool();<br>
- }<br>
- }<br>
+ std::call_once(g_pool_<u></u>initialization_flag, [] () {<br>
+ g_string_pool = new Pool();<br>
+ });<br>
<br>
return *g_string_pool;<br>
}<br>
<br>
<br>
______________________________<u></u>_________________<br>
lldb-commits mailing list<br>
<a href="mailto:lldb-commits@cs.uiuc.edu" target="_blank">lldb-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/lldb-commits</a><br>
</blockquote></div>