Skip to content

Commit

Permalink
Replace unique_lock with scoped_lock
Browse files Browse the repository at this point in the history
unique_lock is overkill for what we're using it for.
  • Loading branch information
dechamps committed Jun 2, 2024
1 parent 6e1be2d commit 3b9b539
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/flexasio/FlexASIO/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 3b9b539

Please sign in to comment.