Commit 77106c1f by Chris Kennelly

Statically initialize benchmark_mutex and extend its lifetime.

RunSpecifiedBenchmarks destroys benchmark_mutex before its last usage, typically in RemoveBenchmark during cleanup of the BenchmarkFamilies singleton.
parent efb9c302
...@@ -184,7 +184,7 @@ inline std::string HumanReadableNumber(double n) { ...@@ -184,7 +184,7 @@ inline std::string HumanReadableNumber(double n) {
// For non-dense Range, intermediate values are powers of kRangeMultiplier. // For non-dense Range, intermediate values are powers of kRangeMultiplier.
static const int kRangeMultiplier = 8; static const int kRangeMultiplier = 8;
static pthread_mutex_t benchmark_mutex; static pthread_mutex_t benchmark_mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t starting_mutex; pthread_mutex_t starting_mutex;
pthread_cond_t starting_cv; pthread_cond_t starting_cv;
...@@ -1222,11 +1222,9 @@ void RunSpecifiedBenchmarks(const BenchmarkReporter* reporter /*= nullptr*/) { ...@@ -1222,11 +1222,9 @@ void RunSpecifiedBenchmarks(const BenchmarkReporter* reporter /*= nullptr*/) {
spec, reporter == nullptr ? &default_reporter : reporter); spec, reporter == nullptr ? &default_reporter : reporter);
pthread_cond_destroy(&starting_cv); pthread_cond_destroy(&starting_cv);
pthread_mutex_destroy(&starting_mutex); pthread_mutex_destroy(&starting_mutex);
pthread_mutex_destroy(&benchmark_mutex);
} }
void Initialize(int* argc, const char** argv) { void Initialize(int* argc, const char** argv) {
pthread_mutex_init(&benchmark_mutex, nullptr);
pthread_mutex_init(&starting_mutex, nullptr); pthread_mutex_init(&starting_mutex, nullptr);
pthread_cond_init(&starting_cv, nullptr); pthread_cond_init(&starting_cv, nullptr);
walltime::Initialize(); walltime::Initialize();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment