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

Will Hawkins via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 10 07:44:11 PDT 2022


hawkinsw added a comment.

In D126240#3564913 <https://reviews.llvm.org/D126240#3564913>, @jgorbe wrote:

> 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.

I am *so* sorry I haven't had a chance to come back to work on this change until now, but I did have one thought that I will investigate this PM. I will keep you posted if I find anything. Again, I am sorry for the radio silence.


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