mirror of
https://github.com/google/benchmark.git
synced 2025-02-06 17:20:15 +08:00
54e18b8992
The multithreaded API for benchmarks provides that teardown can happen in thread 0. For this to be safe, all other threads executing the benchmark function need to have exited. Otherwise, thread 0 may begin to teardown shared resources before the other threads have stopped using these resources as they are in their last loop of while (KeepRunning()) { ... }. This change creates a single exit point for KeepRunning() to return false. When running a multithreaded benchmark, thread 0 blocks on KeepRunning() until all other threads have exited. This approach allows for there to be no change to the user-facing API exemplified in the BM_MultiThreaded example. |
||
---|---|---|
.. | ||
benchmark.cc | ||
CMakeLists.txt | ||
colorprint.cc | ||
colorprint.h | ||
commandlineflags.cc | ||
commandlineflags.h | ||
cycleclock.h | ||
mutex_lock.h | ||
re.cc | ||
re.h | ||
sleep.cc | ||
sleep.h | ||
stat.h | ||
sysinfo.cc | ||
sysinfo.h | ||
walltime.cc | ||
walltime.h |