pub struct SyncChan { /* private fields */ }Expand description
A symmetric bounded channel over IpcMessage, used by the global
channel registry for silo-to-silo syscall-level IPC.
Unlike Sender/Receiver, SyncChan has no directional
specialisation: any caller with an Arc<SyncChan> can both send and
receive. Destruction is explicit (via SyncChan::destroy), triggered
when the last userspace handle is closed.
Implementations§
Source§impl SyncChan
impl SyncChan
Sourcepub fn send(&self, msg: IpcMessage) -> Result<(), ChannelError>
pub fn send(&self, msg: IpcMessage) -> Result<(), ChannelError>
Send a message, blocking until space is available.
Returns Err(ChannelError::Disconnected) if the channel has
been destroyed while the sender was blocked.
Sourcepub fn try_send(&self, msg: IpcMessage) -> Result<(), ChannelError>
pub fn try_send(&self, msg: IpcMessage) -> Result<(), ChannelError>
Try to send without blocking.
Returns Err(WouldBlock) if the queue is full, or
Err(Disconnected) if the channel is destroyed.
Sourcepub fn recv(&self) -> Result<IpcMessage, ChannelError>
pub fn recv(&self) -> Result<IpcMessage, ChannelError>
Receive a message, blocking until one arrives.
Returns Err(ChannelError::Disconnected) if the channel was
destroyed while the receiver was blocked.
Sourcepub fn try_recv(&self) -> Result<IpcMessage, ChannelError>
pub fn try_recv(&self) -> Result<IpcMessage, ChannelError>
Try to receive without blocking.
Returns Err(WouldBlock) if the queue is empty, or
Err(Disconnected) if the channel is destroyed and empty.
Sourcepub fn destroy(&self)
pub fn destroy(&self)
Mark the channel as destroyed and wake all blocked tasks.
Called when the last userspace handle is closed. Subsequent send/recv
operations on any still-held reference return Disconnected.
Sourcepub fn is_destroyed(&self) -> bool
pub fn is_destroyed(&self) -> bool
Returns true if the channel has been destroyed.
Auto Trait Implementations§
impl !Freeze for SyncChan
impl !RefUnwindSafe for SyncChan
impl Send for SyncChan
impl Sync for SyncChan
impl Unpin for SyncChan
impl UnsafeUnpin for SyncChan
impl UnwindSafe for SyncChan
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more