From 2e2daea26308d1ecf692eddb125ea0ce5281f975 Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Sun, 7 Jul 2024 11:39:23 -0700 Subject: [PATCH] Use atomics and `size_t` Using atomics here is essential because this variable may be modified in parallel by different threads. --- libcoz/profiler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcoz/profiler.h b/libcoz/profiler.h index d71dbd8..55a03a9 100644 --- a/libcoz/profiler.h +++ b/libcoz/profiler.h @@ -227,7 +227,7 @@ private: spinlock _latency_points_lock; //< Spinlock that protects the latency points map static_map _thread_states; //< Map from thread IDs to thread-local state - uint64_t _num_threads_running; //< Number of threads that are currently being sampled + std::atomic _num_threads_running; //< Number of threads that are currently being sampled std::atomic _experiment_active; //< Is an experiment running? std::atomic _global_delay; //< The global delay time required