[PATCH] D33581: Fix the ManagedStatic list ordering when using DynamicLibrary::addPermanentLibrary.

Frederich Munch via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 26 11:59:48 PDT 2017


marsupial added inline comments.


================
Comment at: lib/Support/DynamicLibrary.cpp:136
+  if (Handle != &Invalid) {
+    SmartScopedLock<true> Lock(*SymbolsMutex);
+    HS.AddLibrary(Handle, /*IsProcess*/ FileName == nullptr);
----------------
efriedma wrote:
> Why are you changing the scope of this lock?  (What happens if a static constructor in a library calls getPermanentLibrary?)
The ManagedStatic OpenedHandles has a lock for construction.
The SymbolsMutex is the lock for adding to the list.
The way it was before it would be impossible for two threads to execute the DLOpen call in parallel.


https://reviews.llvm.org/D33581





More information about the llvm-commits mailing list