[common] event: consume auto-reset signals atomically

This commit is contained in:
Geoffrey McRae
2026-08-15 13:06:49 +10:00
parent a6a9c909b7
commit c861246d62

View File

@@ -131,15 +131,15 @@ bool lgWaitEventAbs(LGEvent * handle, struct timespec * ts)
}
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)
{
DEBUG_ERROR("Failed to unlock the mutex");
return false;
}
if (ret && handle->autoReset)
atomic_store_explicit(&handle->signaled, false, memory_order_release);
return ret;
}