[Lldb-commits] [PATCH] D40470: Protect DWARFCompileUnit::m_die_array by a new mutex
Jan Kratochvil via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu May 31 03:01:58 PDT 2018
jankratochvil marked an inline comment as done.
jankratochvil added inline comments.
Comment at: source/Plugins/SymbolFile/DWARF/DWARFUnit.h:181
+ // ExtractDIEsIfNeeded() will keep m_die_array populated forever.
+ uint32_t m_die_array_usecount = 0;
// GetUnitDIEPtrOnly() needs to return pointer to the first DIE.
> Why don't we expose the llvm::sys::RWMutex for BuildAddressRangeTable and SymbolFileDWARF::Index? Then they can just grab the read lock?
Wouldn't you prefer an RAII lock (`DWARFUnit::ScopedExtractDIEs`) instead of the mutex exposure?
There are two mutexes (`m_die_array_mutex` and `m_die_array_scoped_mutex`), I tried it using a single mutex (as you IMO suggest) but then one needs to downgrade exclusive->shared lock there which requires a `retry` label there so I did not like the single lock ([[ https://people.redhat.com/jkratoch/mutex2.patch | mutex2.patch ]]).
More information about the lldb-commits