From 3b9b53963f314c5d7d8eed3812f58c0e9e4f181a Mon Sep 17 00:00:00 2001 From: Etienne Dechamps Date: Sun, 2 Jun 2024 11:48:08 +0100 Subject: [PATCH] Replace unique_lock with scoped_lock unique_lock is overkill for what we're using it for. --- src/flexasio/FlexASIO/config.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/flexasio/FlexASIO/config.cpp b/src/flexasio/FlexASIO/config.cpp index 5174dca..ca5dfec 100644 --- a/src/flexasio/FlexASIO/config.cpp +++ b/src/flexasio/FlexASIO/config.cpp @@ -177,7 +177,7 @@ namespace flexasio { ConfigLoader::Watcher::~Watcher() noexcept(false) { Log() << "Stopping config watcher"; { - std::unique_lock lock(directoryMutex); + std::scoped_lock lock(directoryMutex); if (directory != INVALID_HANDLE_VALUE) { Log() << "Cancelling any pending config directory operations"; if (::CancelIoEx(directory, NULL) == 0) @@ -242,13 +242,13 @@ namespace flexasio { throw std::system_error(::GetLastError(), std::system_category(), "Unable to open config directory for watching"); { - std::unique_lock lock(directoryMutex); + std::scoped_lock lock(directoryMutex); assert(directory == INVALID_HANDLE_VALUE); directory = handle; } const auto directoryDeleter = [&](HANDLE handle) { { - std::unique_lock lock(directoryMutex); + std::scoped_lock lock(directoryMutex); assert(directory == handle); directory = INVALID_HANDLE_VALUE; }