From 3c19c7a56e0ada455d4b489774ffbdf64fe9545d Mon Sep 17 00:00:00 2001 From: Jamie Reece Wilson Date: Sat, 30 Dec 2023 14:30:56 +0000 Subject: [PATCH] [*] Fix posix WoASemaphoreImpl --- Source/Threading/Primitives/AuWoASemaphore.Unix.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/Threading/Primitives/AuWoASemaphore.Unix.cpp b/Source/Threading/Primitives/AuWoASemaphore.Unix.cpp index 752c1c42..eba1f77e 100644 --- a/Source/Threading/Primitives/AuWoASemaphore.Unix.cpp +++ b/Source/Threading/Primitives/AuWoASemaphore.Unix.cpp @@ -152,7 +152,7 @@ namespace Aurora::Threading::Primitives WoASemaphoreImpl::~WoASemaphoreImpl() { - ::pthread_cond_destroy(&this->pthreadCv_); + } bool WoASemaphoreImpl::HasOSHandle(AuMach &mach) @@ -182,6 +182,7 @@ namespace Aurora::Threading::Primitives { while (!this->TryLock()) { + AU_LOCK_GUARD(this->mutex_); (void)this->cond_.WaitForSignalNsEx(&this->mutex_, 0, true); } @@ -194,7 +195,11 @@ namespace Aurora::Threading::Primitives return true; } - (void)this->cond_.WaitForSignalNsEx(&this->mutex_, uTimeout, true); + { + AU_LOCK_GUARD(this->mutex_); + (void)this->cond_.WaitForSignalNsEx(&this->mutex_, uTimeout, true); + } + return this->TryLock(); } }