mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-08-22 15:11:31 +00:00
[common] event: consume auto-reset signals atomically
This commit is contained in:
@@ -131,15 +131,15 @@ bool lgWaitEventAbs(LGEvent * handle, struct timespec * ts)
|
|||||||
}
|
}
|
||||||
|
|
||||||
atomic_fetch_sub_explicit(&handle->waiting, 1, memory_order_release);
|
atomic_fetch_sub_explicit(&handle->waiting, 1, memory_order_release);
|
||||||
|
if (ret && handle->autoReset)
|
||||||
|
atomic_store_explicit(&handle->signaled, false, memory_order_release);
|
||||||
|
|
||||||
if (pthread_mutex_unlock(&handle->mutex) != 0)
|
if (pthread_mutex_unlock(&handle->mutex) != 0)
|
||||||
{
|
{
|
||||||
DEBUG_ERROR("Failed to unlock the mutex");
|
DEBUG_ERROR("Failed to unlock the mutex");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret && handle->autoReset)
|
|
||||||
atomic_store_explicit(&handle->signaled, false, memory_order_release);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user