pub struct IntrusiveMailbox {
head: AtomicUsize,
}Expand description
A lock-free LIFO mailbox (stack) for kernel-internal IPC.
Messages are pushed atomically to the head of an intrusive linked list and popped from the head. This is not a FIFO queue : message order is reversed on reception.
§Use case
Use for notification-style IPC between trusted kernel components where
low latency (~10 cycles) matters more than message ordering. For
FIFO-guaranteed IPC, use LockFreeRing.
Fields§
§head: AtomicUsizeImplementations§
Source§impl IntrusiveMailbox
impl IntrusiveMailbox
Sourcepub fn push(&self, msg: &[u8]) -> Result<(), MailboxError>
pub fn push(&self, msg: &[u8]) -> Result<(), MailboxError>
Push a message onto the mailbox (LIFO : inserted at head).
Allocates a new MailboxMessage from the kernel heap.
This allocation is the primary cost; for a deterministic fast path
consider a pre-allocated freelist (see design doc §12.15).
Sourcepub fn pop(&self) -> Option<Box<MailboxMessage>>
pub fn pop(&self) -> Option<Box<MailboxMessage>>
Pop a message from the mailbox (LIFO : from head).
Trait Implementations§
Source§impl Debug for IntrusiveMailbox
impl Debug for IntrusiveMailbox
Source§impl IpcConsumer for IntrusiveMailbox
impl IpcConsumer for IntrusiveMailbox
Source§impl IpcProducer for IntrusiveMailbox
impl IpcProducer for IntrusiveMailbox
Source§impl IpcTransport for IntrusiveMailbox
impl IpcTransport for IntrusiveMailbox
Source§fn level(&self) -> TransportLevel
fn level(&self) -> TransportLevel
The isolation level of this transport.
Source§fn capabilities(&self) -> TransportCapabilities
fn capabilities(&self) -> TransportCapabilities
Static capabilities of this transport.
Auto Trait Implementations§
impl !Freeze for IntrusiveMailbox
impl RefUnwindSafe for IntrusiveMailbox
impl Send for IntrusiveMailbox
impl Sync for IntrusiveMailbox
impl Unpin for IntrusiveMailbox
impl UnsafeUnpin for IntrusiveMailbox
impl UnwindSafe for IntrusiveMailbox
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
Converts
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>
Converts
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