[PATCH] D33581: Fix the ManagedStatic list ordering when using DynamicLibrary::addPermanentLibrary.
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 26 12:09:35 PDT 2017
efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.
LGTM.
================
Comment at: lib/Support/DynamicLibrary.cpp:136
+ if (Handle != &Invalid) {
+ SmartScopedLock<true> Lock(*SymbolsMutex);
+ HS.AddLibrary(Handle, /*IsProcess*/ FileName == nullptr);
----------------
marsupial wrote:
> 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.
Okay, that makes sense.
https://reviews.llvm.org/D33581
More information about the llvm-commits
mailing list