From ea88934c214364b7dd09508201b69840aec18d4e Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 17 Dec 2021 19:14:28 +0100 Subject: [PATCH] Unique lock on event set and reset. --- src/cpp11_thread.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cpp11_thread.cpp b/src/cpp11_thread.cpp index 2b56ae2f6..3185e574d 100644 --- a/src/cpp11_thread.cpp +++ b/src/cpp11_thread.cpp @@ -109,7 +109,7 @@ void thread_set_event(event_t *handle) { auto event = reinterpret_cast(handle); - std::lock_guard lock(event->mutex); + std::unique_lock lock(event->mutex); event->state = true; event->cond.notify_all(); @@ -119,7 +119,7 @@ void thread_reset_event(event_t *handle) { auto event = reinterpret_cast(handle); - std::lock_guard lock(event->mutex); + std::unique_lock lock(event->mutex); event->state = false; }