pub struct RingExecutor { /* private fields */ }Expand description
A hardware-shaped pool of worker threads draining an unbounded set of tasks through per-worker SubEtha ready-ring shards.
Implementations§
Source§impl RingExecutor
impl RingExecutor
Sourcepub fn with_available_parallelism(max_tasks: usize) -> Self
pub fn with_available_parallelism(max_tasks: usize) -> Self
Build an executor whose worker count matches the host’s logical
core count (std::thread::available_parallelism). The ready
queue gets one shard per worker; max_tasks is the peak number
of simultaneously-live tasks the queue must hold.
Sourcepub fn new(n_workers: usize, max_tasks: usize) -> Self
pub fn new(n_workers: usize, max_tasks: usize) -> Self
Build an executor with n_workers worker threads (one ready
shard each) and a ready queue sized to hold at least max_tasks
simultaneously-live task handles, spread across the shards.
Sourcepub fn spawn(&self, future: impl Future<Output = ()> + Send + 'static)
pub fn spawn(&self, future: impl Future<Output = ()> + Send + 'static)
Spawn a future. It runs to completion on the pool, suspending (off-thread) whenever it awaits, with no thread dedicated to it.
Sourcepub fn worker_count(&self) -> usize
pub fn worker_count(&self) -> usize
Number of worker threads (one ready shard each).
Sourcepub fn shard_count(&self) -> usize
pub fn shard_count(&self) -> usize
Number of ready-ring shards (equals worker count).
Sourcepub fn pinned_workers(&self) -> usize
pub fn pinned_workers(&self) -> usize
How many workers were pinned to a distinct core (best-effort; 0 on hosts without an affinity API). Read after the workers have started.
Sourcepub fn shard_capacity(&self) -> usize
pub fn shard_capacity(&self) -> usize
Per-shard slot capacity (power of two).