This makes some of the tests not flaky anymore, updates some tests to also work in C++03 and modernizes them in general.
std::lock_guard
_LIBCPP_HAS_NO_THREADS