From c861246d6219ab01e1e6a84f1e96cc3294beb197 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sat, 15 Aug 2026 13:06:49 +1000 Subject: [PATCH] [common] event: consume auto-reset signals atomically --- common/src/platform/linux/event.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/src/platform/linux/event.c b/common/src/platform/linux/event.c index ccf0603b..692d9197 100644 --- a/common/src/platform/linux/event.c +++ b/common/src/platform/linux/event.c @@ -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; }