mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-04-26 00:26:32 +00:00
[common] events/linux: fix failure to call pthread_cond_broadcast
This commit is contained in:
parent
96bcfff28b
commit
a094fb8104
@ -175,15 +175,25 @@ bool lgSignalEvent(LGEvent * handle)
|
|||||||
{
|
{
|
||||||
assert(handle);
|
assert(handle);
|
||||||
|
|
||||||
|
if (pthread_mutex_lock(&handle->mutex) != 0)
|
||||||
|
{
|
||||||
|
DEBUG_ERROR("Failed to lock the mutex");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const bool signaled = atomic_exchange_explicit(&handle->signaled, true,
|
const bool signaled = atomic_exchange_explicit(&handle->signaled, true,
|
||||||
memory_order_release);
|
memory_order_release);
|
||||||
|
|
||||||
if (signaled)
|
if (!signaled)
|
||||||
return true;
|
if (pthread_cond_broadcast(&handle->cond) != 0)
|
||||||
|
{
|
||||||
|
DEBUG_ERROR("Failed to signal the condition");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (pthread_cond_broadcast(&handle->cond) != 0)
|
if (pthread_mutex_unlock(&handle->mutex) != 0)
|
||||||
{
|
{
|
||||||
DEBUG_ERROR("Failed to signal the condition");
|
DEBUG_ERROR("Failed to unlock the mutex");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user