This patch automatically versions the shared libraries from any annotated `git`
tags:
```
git tag -a v1.0.0
```
It expects semver version tags such as `v1.0.0`. It would be trivial to support
`1.0.0` but looking around it seems that most C/C++ projects follow `vX.X.X`
rather that `X.X.X` like a lot of `Node.js` stuff.
This determines that the if the project has had a certain amount of commits
since the last tag and also if the project is _dirty_ (has modified files), but
does __nothing__ with that information. In the future a more robust release
could be implemented in the script.
This is pretty brittle and has little in the way of configuration. Ideally we
should use `find_program` to work out where `git` is so that users can configure
it. This implementation assumes that `git` will be available in `PATH`
Outputs the following on the command line:
```
-- git Version: v[MAJOR].[MINOR].[PATCH]-[COMMITS_SINCE_TAG]-[SHA1](-dirty)?
-- Version: [MAJOR].[MINOR].[PATCH]
```
InitType should hold a lock before storing to approx_time_, which is later
read by the background worker. When the worker is actively running (i.e., not
blocked on bg_cond_) it holds bg_mutex_.
InitType is called during benchmark setup only, so any contention induced for
the mutex should not have performance/accuracy consequences.
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.