pub struct Shutdown { /* private fields */ }Expand description
A shared shutdown signal for coordinating graceful termination.
use photon_ring::Shutdown;
let shutdown = Shutdown::new();
let flag = shutdown.clone();
// In consumer thread:
// while !flag.is_shutdown() {
// match sub.try_recv() {
// Ok(v) => { /* process */ }
// Err(_) => core::hint::spin_loop(),
// }
// }
// In main thread:
shutdown.trigger();
assert!(flag.is_shutdown());Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Shutdown
impl RefUnwindSafe for Shutdown
impl Send for Shutdown
impl Sync for Shutdown
impl Unpin for Shutdown
impl UnsafeUnpin for Shutdown
impl UnwindSafe for Shutdown
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