[libcxx-commits] [libcxx] Fix async test (PR #146240)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 30 01:10:48 PDT 2025


philnik777 wrote:

> This test was deadlocking on my machine.
> 
> It seems to me the intention of `in_async.wait(...)` was to wait for the value to be set to true, which requires a call of `wait(false)` (waits if value matches argument).

Yes, I've got that backwards.

> ~As a drive by change scoped_lock to unique_lock, since there shouldn't be any functional difference between the two in this test.~
> 
> I've addressed the issues with the `in_async` by switching to a condition variable instead, since my first attempt at fixing this with `in_async` wasn't sufficient.

Could you elaborate? I just testted with changing `in_async.wait(true)` to `in_async.wait(false)` and it ran successfully 1000 times.


https://github.com/llvm/llvm-project/pull/146240


More information about the libcxx-commits mailing list