[*] Fix posix WoASemaphoreImpl

This commit is contained in:
Reece Wilson 2023-12-30 14:30:56 +00:00
parent ba6162a7ad
commit 3c19c7a56e

View File

@ -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();
}
}