From 0b79bee44a6d8e5c5481b9eca9a79731e5ea9e5a Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Mon, 29 Jan 2024 15:41:22 -0800 Subject: [PATCH] executor: Fix issue when task is scheduled within event callback I believe this should be overall more correct. Previously, if the callback taken by `process_events` scheduled a task, `process_events` could exit with the readiness of `self.ping` cleared, but `notified` set to `true`. In which case, future calls to `schedule` would not wake the event source. Fixes https://github.com/Smithay/calloop/issues/171. --- src/sources/futures.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sources/futures.rs b/src/sources/futures.rs index 3a56e005..65e3fc30 100644 --- a/src/sources/futures.rs +++ b/src/sources/futures.rs @@ -296,9 +296,6 @@ impl EventSource for Executor { { let state = &self.state; - // Set to the unnotified state. - state.sender.notified.store(false, Ordering::SeqCst); - let clear_readiness = { let mut clear_readiness = false; @@ -347,6 +344,9 @@ impl EventSource for Executor { .map_err(ExecutorError::WakeError)?; } + // Set to the unnotified state. + state.sender.notified.store(false, Ordering::SeqCst); + Ok(PostAction::Continue) }