[PATCH] Change the LLVM global lock to use RAII semantics
Chandler Carruth
chandlerc at gmail.com
Fri Jun 13 17:10:25 PDT 2014
================
Comment at: lib/Support/Threading.cpp:25
@@ +24,3 @@
+sys::Mutex &llvm::llvm_get_global_lock() {
+ static sys::Mutex global_lock;
+ return global_lock;
----------------
Is the constructor for a mutex threadsafe? Because we use VS versions which don't provide a thread safe initialization. Actually, even if the constructor is threadsafe, won't that still form a data race if we call this from two threads when built with MSVC?
I think you'll need this to be a static global ultimately... =/
http://reviews.llvm.org/D4142
More information about the llvm-commits
mailing list