pub struct PipedLink<O: Send + Sync + 'static, I: Send + Sync + 'static> { /* private fields */ }
Expand description
Link from a PipedThread
thread back to the main thread
Implementations§
source§impl<O: Send + Sync + 'static, I: Send + Sync + 'static> PipedLink<O, I>
impl<O: Send + Sync + 'static, I: Send + Sync + 'static> PipedLink<O, I>
sourcepub fn send(&mut self, msg: I) -> bool
pub fn send(&mut self, msg: I) -> bool
Send a message back to the main thread. Returns true
on
success. If false
is returned, then the PipedThread
has
been dropped and this thread should terminate itself.
sourcepub fn recv(&mut self) -> Option<O>
pub fn recv(&mut self) -> Option<O>
Receive a message from the main thread. Blocks if there is no
message already waiting. Returns None
if the
PipedThread
has been dropped, in which case this thread
should terminate itself.
sourcepub fn cancel(&mut self) -> bool
pub fn cancel(&mut self) -> bool
Check whether cancellation has been flagged by the main
thread. When the PipedThread
is dropped, the cancel flag
is set to tell this thread to terminate. If the thread is
doing a long-running operation or blocking, it should check
the cancel flag from time to time to recognise this
condition and to clean up in good time.
Auto Trait Implementations§
impl<O, I> !RefUnwindSafe for PipedLink<O, I>
impl<O, I> Send for PipedLink<O, I>
impl<O, I> Sync for PipedLink<O, I>
impl<O, I> Unpin for PipedLink<O, I>
impl<O, I> !UnwindSafe for PipedLink<O, I>
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