[Lldb-commits] [PATCH] D157041: [lldb] Protect OptionValue accesses from data races

Alex Langford via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 3 16:24:28 PDT 2023


bulbazord added a comment.

In D157041#4559255 <https://reviews.llvm.org/D157041#4559255>, @augusto2112 wrote:

>> Do all of these need to be protected with a mutex? In your description you're saying TSan is detecting data races. What piece of data are you observing the data race on?
>
> Only SetAsBoolean/GetAsBoolean are being caught when running our test suite at the moment.
>
>> Do we need a recursive mutex? I assume that these operations might call into each other, but if not it would be nice to just have it be a std::mutex.
>
> If we want to protect all accesses then yes, since these functions call each other. It we decide to only lock against what's being caught by tsan then we can get by with a regular mutex.

Only `SetAsBoolean` and `GetAsBoolean` are being caught right now, I see. The implementation of those methods really isn't any different (AFAICT) from the other methods so I would assume we would need to protect all the other `Get` and `Set` methods as well then, makes sense. I'd probably keep the recursive mutex for now then.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157041



More information about the lldb-commits mailing list