Struct calloop::LoopSignal
source · pub struct LoopSignal { /* private fields */ }
Expand description
A signal that can be shared between thread to stop or wakeup a running event loop
Implementations§
source§impl LoopSignal
impl LoopSignal
sourcepub fn stop(&self)
pub fn stop(&self)
Stop the event loop
Once this method is called, the next time the event loop has finished waiting for events, it will return rather than starting to wait again.
This is only useful if you are using the EventLoop::run()
method.
sourcepub fn wakeup(&self)
pub fn wakeup(&self)
Wake up the event loop
This sends a dummy event to the event loop to simulate the reception
of an event, making the wait return early. Called after stop()
, this
ensures the event loop will terminate quickly if you specified a long
timeout (or no timeout at all) to the dispatch
or run
method.
Trait Implementations§
source§impl Clone for LoopSignal
impl Clone for LoopSignal
source§fn clone(&self) -> LoopSignal
fn clone(&self) -> LoopSignal
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl RefUnwindSafe for LoopSignal
impl Send for LoopSignal
impl Sync for LoopSignal
impl Unpin for LoopSignal
impl UnwindSafe for LoopSignal
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more