clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

"thread_local" isn't well supported and has performance issues. See inlined 
comments.


================
Comment at: include/lldb/Core/Timer.h:89
@@ +88,3 @@
+
+    static thread_local unsigned g_depth;
+
----------------
Not sure if all platforms support thread_local correctly. MacOSX might not. I 
also spoke with some compiler folks on using "thread_local" and they warned 
that the C++11 spec requires a bunch of other stuff gets initialized when _any_ 
thread_local variable gets used, so I was told that using the "__thread" 
instead of much better to do. So switch this from thread_local to __thread and 
it should work on most platforms. Not sure if windows will have a problem with 
this. 

So the best fix is probably to make a LLDB_THREAD_LOCAL #define in 
lldb-defines.h and define it to "__thread" by default. Windows can fix up as 
needed.

================
Comment at: source/Core/Timer.cpp:27
@@ +26,3 @@
+
+thread_local unsigned Timer::g_depth(0);
+
----------------
Use LLDB_THREAD_LOCAL instead of "thread_local".


http://reviews.llvm.org/D13940



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to