What about std::mutex and std::lock_guard<> or std::unique_lock<>