================ @@ -25,19 +25,25 @@ TypeCategoryMap::TypeCategoryMap(IFormatChangeListener *lst) } void TypeCategoryMap::Add(KeyType name, const TypeCategoryImplSP &entry) { - std::lock_guard<std::recursive_mutex> guard(m_map_mutex); - m_map[name] = entry; + { + std::lock_guard<std::recursive_mutex> guard(m_map_mutex); + m_map[name] = entry; + } + // The lock is now released for the eventual call to Changed. ---------------- JDevlieghere wrote:
This comment explains _what_ you're doing, which the code already tells me, but not _why_. I'd expect something like this, although it doesn't need to be quite so verbose: ``` // Release the mutex to avoid a potential deadlock between TypeCategoryMap::m_map_mutex and FormatManager::m_language_categories_mutex which can be acquired in reverse order when calling FormatManager::Changed. ``` https://github.com/llvm/llvm-project/pull/87540 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits