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

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to