From fdb1c56366af62a05c1f655ce159b214ac80172f Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Thu, 25 May 2017 02:52:35 +1000 Subject: [PATCH] Move interrupt flag reset to beginning of run_forever in wayland backend --- src/platform/linux/wayland/event_loop.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/platform/linux/wayland/event_loop.rs b/src/platform/linux/wayland/event_loop.rs index d21597b7..b86e4635 100644 --- a/src/platform/linux/wayland/event_loop.rs +++ b/src/platform/linux/wayland/event_loop.rs @@ -181,6 +181,8 @@ impl EventsLoop { pub fn run_forever(&self, callback: F) where F: FnMut(::Event) { + self.interrupted.store(false, ::std::sync::atomic::Ordering::Relaxed); + // send pending requests to the server... self.ctxt.flush(); @@ -193,13 +195,7 @@ impl EventsLoop { let static_cb = unsafe { ::std::mem::transmute(Box::new(callback) as Box) }; let old_cb = unsafe { self.sink.lock().unwrap().set_callback(static_cb) }; - loop { - // If `interrupt` was called, break from the loop after resetting the flag. - if self.interrupted.load(::std::sync::atomic::Ordering::Relaxed) { - self.interrupted.store(false, ::std::sync::atomic::Ordering::Relaxed); - break; - } - + while !self.interrupted.load(::std::sync::atomic::Ordering::Relaxed) { self.ctxt.dispatch(); evq_guard.dispatch_pending().expect("Wayland connection unexpectedly lost"); let ids_guard = self.decorated_ids.lock().unwrap();