summaryrefslogtreecommitdiff
path: root/absl/synchronization/blocking_counter_benchmark.cc
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2023-12-26 21:22:51 -0800
committerGravatar Copybara-Service <copybara-worker@google.com>2023-12-26 21:23:47 -0800
commitf9228ec834edef9b623d4824dd006890c203adc3 (patch)
treec41a1f543553fb5c8416005bfdb55048b2902d10 /absl/synchronization/blocking_counter_benchmark.cc
parentbd47468324e0db12aac9a57128d40fc23c233fb4 (diff)
Migrate static objects to NoDestructor in tests, testing libraries and benchmarks.
PiperOrigin-RevId: 593918110 Change-Id: Ide100c69b10e28011af17c7f82bb10eea072cad4
Diffstat (limited to 'absl/synchronization/blocking_counter_benchmark.cc')
-rw-r--r--absl/synchronization/blocking_counter_benchmark.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/absl/synchronization/blocking_counter_benchmark.cc b/absl/synchronization/blocking_counter_benchmark.cc
index b504d1a5..ea2bf9f9 100644
--- a/absl/synchronization/blocking_counter_benchmark.cc
+++ b/absl/synchronization/blocking_counter_benchmark.cc
@@ -14,6 +14,7 @@
#include <limits>
+#include "absl/base/no_destructor.h"
#include "absl/synchronization/blocking_counter.h"
#include "absl/synchronization/internal/thread_pool.h"
#include "benchmark/benchmark.h"
@@ -39,8 +40,8 @@ BENCHMARK(BM_BlockingCounter_SingleThread)
->Arg(256);
void BM_BlockingCounter_DecrementCount(benchmark::State& state) {
- static absl::BlockingCounter* counter =
- new absl::BlockingCounter{std::numeric_limits<int>::max()};
+ static absl::NoDestructor<absl::BlockingCounter> counter(
+ std::numeric_limits<int>::max());
for (auto _ : state) {
counter->DecrementCount();
}