Re: [PATCH 3/4] libstdc++: Optimize std::binary_semaphore

2025-06-04 Thread Jonathan Wakely
On Wed, 4 Jun 2025 at 13:44, Tomasz Kaminski wrote: > > On Tue, Jun 3, 2025 at 6:06 PM Jonathan Wakely wrote: >> >> On Tue, 3 Jun 2025 at 09:46, Jonathan Wakely wrote: >> > >> > This adds a new implementation of std::counting_semaphore for the >> > case where Max == 1, i.e. the std::binary_semaph

Re: [PATCH 3/4] libstdc++: Optimize std::binary_semaphore

2025-06-04 Thread Tomasz Kaminski
On Tue, Jun 3, 2025 at 6:06 PM Jonathan Wakely wrote: > On Tue, 3 Jun 2025 at 09:46, Jonathan Wakely wrote: > > > > This adds a new implementation of std::counting_semaphore for the > > case where Max == 1, i.e. the std::binary_semaphore typedef. When the > > maximum counter value is 1 we don't n

Re: [PATCH 3/4] libstdc++: Optimize std::binary_semaphore

2025-06-03 Thread Jonathan Wakely
On Tue, 3 Jun 2025 at 09:46, Jonathan Wakely wrote: > > This adds a new implementation of std::counting_semaphore for the > case where Max == 1, i.e. the std::binary_semaphore typedef. When the > maximum counter value is 1 we don't need to load the current counter > value before doing a compare-exc

[PATCH 3/4] libstdc++: Optimize std::binary_semaphore

2025-06-03 Thread Jonathan Wakely
This adds a new implementation of std::counting_semaphore for the case where Max == 1, i.e. the std::binary_semaphore typedef. When the maximum counter value is 1 we don't need to load the current counter value before doing a compare-exchange to acquire the semaphore. We can just optimisitcally ass