This change adds wrappers for std::unique_lock and std::recursive_lock and adds thread annotations so the code can be compiled with "-Wthread-safety -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS".
See also https://clang.llvm.org/docs/ThreadSafetyAnalysis.html