[libcxx-commits] [libcxx] [libc++][test][NFC] remove unused variables in the test (PR #179038)

via libcxx-commits libcxx-commits at lists.llvm.org
Sun Feb 1 00:35:07 PST 2026


================
@@ -14,39 +14,37 @@
 // Test that counting_semaphore::try_acquire_for does not suffer from lost wakeup
 // under stress testing.
 
-#include <barrier>
 #include <chrono>
+#include <functional>
 #include <semaphore>
 #include <thread>
 #include <vector>
 
 #include "make_test_thread.h"
 
-static std::counting_semaphore<> s(0);
 constexpr auto num_acquirer   = 100;
 constexpr auto num_iterations = 5000;
-static std::barrier<> b(num_acquirer + 1);
 
-void acquire() {
+void acquire(std::counting_semaphore<>& s) {
----------------
huixie90 wrote:

I don't think global variables are any good. If one day, these classes become `constexpr`, global variables will just make the test harder to become `constexpr`

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


More information about the libcxx-commits mailing list