Use std::lock_guard instead of lock/unlock manually.