google/benchmark — pull request #22 by ckennelly (2014-05-05 16:44:50+00:00)
Title: 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.

When compiled with `-fsanitize=thread` with Clang, `benchmark_test` emits an error during shutdown:

```
ThreadSanitizer WARNING: unlock of unlocked mutex
#0 pthread_mutex_unlock ??:0 (exe+0x00000003c44c)
#1 ~mutex_lock /home/ckennelly/projects/benchmark/src/mutex_lock.h:13 (exe+0x000000096793)
#2 ~mutex_lock /home/ckennelly/projects/benchmark/src/mutex_lock.h:13 (exe+0x00000007f4f0)
#3 benchmark::internal::BenchmarkFamilies::RemoveBenchmark(int) /home/ckennelly/projects/benchmark/src/benchmark.cc:343 (exe+0x000000073ddd)
#4 ~Benchmark /home/ckennelly/projects/benchmark/src/benchmark.cc:695 (exe+0x000000077fbe)
#5 ~BenchmarkFamilies /home/ckennelly/projects/benchmark/src/benchmark.cc:324 (exe+0x000000073ac5)
#6 __libc_secure_getenv ??:0 (libc.so.6+0x000000037c88)
```