Use a `std::lock_guard<std::mutex>` to get automatic unlocking