[PATCH] Removing the static destructor from ManagedStatic.cpp by controlling the allocation and de-allocaation of the mutex.

Chandler Carruth chandlerc at gmail.com
Tue Sep 23 15:46:25 PDT 2014


================
Comment at: lib/Support/ManagedStatic.cpp:30
@@ -29,1 +29,3 @@
+  if (nullptr == ManagedStaticMutex)
+    ManagedStaticMutex = new sys::Mutex();
   return ManagedStaticMutex;
----------------
Uh... How is this safe? How does this bootstrap when it is called while acquiring a lock (and thus concurrently without any other synchronization)?

http://reviews.llvm.org/D5473






More information about the llvm-commits mailing list