[Lldb-commits] [PATCH] D126240: [lldb] Tighten the scope of a couple of locks in DataFormatters.

Jorge Gorbe Moya via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 7 15:09:19 PDT 2022


jgorbe added a comment.

I've been experimenting a little bit and it seems that I can avoid the deadlocks I was seeing by applying only the modification to `TypeCategoryMap::Add`. This would avoid the problem that @hawkinsw pointed out in my change to `FormatManager::GetCategoryForLanguage`. However, the following problem could still happen with the change to `TypeCategoryMap::Add`:

1. Thread A acquires the lock, runs `m_map[key1] = value1`, and releases the lock
2. Thread B acquires the lock, runs `m_map[key2] = value2`, and releases the lock
3. Thread A runs `listener->Changed()`
4. Thread B runs `listener->Changed()`

So we would have two changes, the listener would be called twice, but both listener calls would see the same state with the two changes already applied, instead of observing each change individually. I'll keep thinking to see if I can fix this elsewhere.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126240/new/

https://reviews.llvm.org/D126240



More information about the lldb-commits mailing list