[libcxx-commits] [libcxx] [libc++] fix `counting_semaphore` lost wakeups (PR #79265)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Feb 2 09:40:41 PST 2024
https://github.com/ldionne approved this pull request.
I just went through the whole thread. I think this is an amazing discussion, and one that greatly needs to happen since our synchronization library is way too complicated right now.
Personally, I really like the idea that we're able to implement e.g. `latch` and `barrier` using `std::atomic` public APIs exclusively, but I'm also not blindly attached to it.
>From a tactical perspective, I would suggest moving forward with this patch even though I know both of you are not satisfied with the way the code looks. At least we are fixing two real bugs and making the code "better" in terms of correctness.
I would then greatly encourage refactorings both in the implementation of `barrier`, `latch` & al, and also in the implementation of `__cxx_atomic_wait`, which is really brittle right now. But I would suggest tackling those as separate patches that would aim not to change the functionality in major ways.
I am fine with having the code in an intermediate state that we're not happy refactoring-wise, since these issues are complex enough that it's worth compartmenting how we tackle them (functional change + follow-up refactor).
I'm approving this patch w/ the `__old == 0` optimization and I encourage the discussion about refactoring to keep going either here or on a follow-up PR/issue.
https://github.com/llvm/llvm-project/pull/79265
More information about the libcxx-commits
mailing list