Re: [PATCH 4/4] libstdc++: Optimize std::counting_semaphore for futex path

2025-06-04 Thread Tomasz Kaminski
I would prefer design when we have a platform_semaphore_base that is defined only if _GLIBCXX_HAVE_PLATFORM_WAIT, and semaphore_base. For the platform_semaphore, this could you binary_semaphore code, with two modification: static constexpr ptrdiff_t _S_max = _Binary ? 1 : numeric_limits::Max;

[PATCH 4/4] libstdc++: Optimize std::counting_semaphore for futex path

2025-06-03 Thread Jonathan Wakely
When the semaphore counter is __platform_wait_t we can use the simpler atomic waiting functions that just take a value and wait for it to change, instead of using an accessor function and a predicate to fetch and compare the value. Because the simpler value-based waiting functions don't return the