pub struct InterCoreQueue { /* private fields */ }Expand description
Cache-line-padded SPSC inter-core message queue.
One instance per (source_core, dest_core) pair. The #[repr(align(64))]
ensures that adjacent queue entries in a Vec<InterCoreQueue> do not share
a cache line, preventing false sharing between cores that access different
pairs.
Uses crossbeam_queue::ArrayQueue for wait-free push/pop. push
returns false when the queue is at capacity — callers should treat this
as a backpressure signal.
Implementations§
Source§impl InterCoreQueue
impl InterCoreQueue
pub fn new(capacity: usize) -> Self
Sourcepub fn push(&self, msg: MailboxMessage) -> bool
pub fn push(&self, msg: MailboxMessage) -> bool
Push a message. Returns false if the queue is full.
Sourcepub fn pop(&self) -> Option<MailboxMessage>
pub fn pop(&self) -> Option<MailboxMessage>
Pop the next message, or None if empty.
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
pub fn capacity(&self) -> usize
Auto Trait Implementations§
impl !Freeze for InterCoreQueue
impl RefUnwindSafe for InterCoreQueue
impl Send for InterCoreQueue
impl Sync for InterCoreQueue
impl Unpin for InterCoreQueue
impl UnsafeUnpin for InterCoreQueue
impl UnwindSafe for InterCoreQueue
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