pub struct SharedDequeUrd { /* private fields */ }Expand description
MMF-backed UMWAIT Rendezvous Deque. Single owner, N pre-configured thieves.
Implementations§
Sourcepub fn create<P: AsRef<Path>>(path: P, n_mailboxes: usize) -> Result<Self>
pub fn create<P: AsRef<Path>>(path: P, n_mailboxes: usize) -> Result<Self>
Create a fresh URD file with n_mailboxes mailboxes (one
per intended thief). Minimum 1. The round-robin cursor
reduces modulo n_mailboxes (no pow2 requirement so a
single-thief bench can use n = 1).
Sourcepub fn n_mailboxes(&self) -> usize
pub fn n_mailboxes(&self) -> usize
Number of configured mailboxes.
Sourcepub fn wait_strategy(&self) -> WaitStrategy
pub fn wait_strategy(&self) -> WaitStrategy
Wait strategy this URD instance picked (per CPUID).
Sourcepub fn publish_strategy(&self) -> PublishStrategy
pub fn publish_strategy(&self) -> PublishStrategy
Publish strategy this URD instance picked (per CPUID).
Sourcepub fn close_owner(&self)
pub fn close_owner(&self)
Owner shutdown: zero pid + advance epoch.
Sourcepub fn publish_to(
&self,
target: usize,
items: &[LineItem],
) -> Result<usize, PublishError>
pub fn publish_to( &self, target: usize, items: &[LineItem], ) -> Result<usize, PublishError>
Owner-side: publish items to mailbox target. Spins until
the mailbox is EMPTY (the previous batch has been consumed),
then publishes via the per-host
PublishStrategy:
PublishStrategy::Movdir64b: builds a 64-byte source line and atomically writes the whole mailbox cache line via theMOVDIR64Binstruction (one Write-Combining store, no RFO).PublishStrategy::Scalar: writes items via cached stores, then Release-stores the state word to READY (two- step protocol).
Returns the number of items published.
Sourcepub fn publish_round_robin(
&self,
items: &[LineItem],
) -> Result<(usize, usize), PublishError>
pub fn publish_round_robin( &self, items: &[LineItem], ) -> Result<(usize, usize), PublishError>
Owner-side: publish items to the next round-robin mailbox.
Returns (target, n_published).
Sourcepub fn drain_mailbox(&self, mailbox_idx: usize) -> Drain
pub fn drain_mailbox(&self, mailbox_idx: usize) -> Drain
Thief-side: drain own mailbox if it has READY items.
mailbox_idx is the thief’s pre-assigned mailbox. Returns
Drain::Empty when the state byte is EMPTY (no work
published yet).
Sourcepub fn wait_and_drain(&self, mailbox_idx: usize, deadline_tsc: u64) -> Drain
pub fn wait_and_drain(&self, mailbox_idx: usize, deadline_tsc: u64) -> Drain
Thief-side: block (per the host’s WaitStrategy) until
the mailbox transitions to READY, then drain it.
On WAITPKG-capable hardware the thief uses UMONITOR +
UMWAIT to halt; otherwise it uses PAUSE-spin. The
deadline is expressed as the absolute TSC value at which
UMWAIT returns even if the line has not transitioned;
u64::MAX means “no deadline” (wait indefinitely - protocol
risk if the owner never publishes).
Sourcepub fn flush_to_disk(&self) -> Result<()>
pub fn flush_to_disk(&self) -> Result<()>
Force any dirty pages to disk.