pub struct AffinitizedThreadpool { /* private fields */ }
Expand description
A pool of affinitized worker threads.
Implementations§
Source§impl AffinitizedThreadpool
impl AffinitizedThreadpool
Sourcepub fn new(io_ring_size: u32) -> Result<Self>
pub fn new(io_ring_size: u32) -> Result<Self>
Creates a new threadpool with the specified ring size.
Sourcepub fn current_driver(&self) -> &ThreadpoolDriver
pub fn current_driver(&self) -> &ThreadpoolDriver
Returns an object that can be used to submit IOs or spawn tasks to the current processor’s ring.
Spawned tasks will remain affinitized to the current thread. Spawn directly on the threadpool object to get a task that will run on any thread.
Sourcepub fn driver(&self, ring_id: u32) -> &ThreadpoolDriver
pub fn driver(&self, ring_id: u32) -> &ThreadpoolDriver
Returns an object that can be used to submit IOs to the specified ring in the pool, or to spawn tasks on the specified thread.
Spawned tasks will remain affinitized to the specified thread. Spawn directly on the threadpool object to get a task that will run on any thread.
Sourcepub fn active_drivers(&self) -> impl Iterator<Item = &ThreadpoolDriver> + Clone
pub fn active_drivers(&self) -> impl Iterator<Item = &ThreadpoolDriver> + Clone
Returns an iterator of drivers for threads that are running and have their affinity set.
This is useful for getting a set of drivers that can be used to parallelize work.
Trait Implementations§
Source§impl Clone for AffinitizedThreadpool
impl Clone for AffinitizedThreadpool
Source§fn clone(&self) -> AffinitizedThreadpool
fn clone(&self) -> AffinitizedThreadpool
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for AffinitizedThreadpool
impl Debug for AffinitizedThreadpool
Source§impl Initiate for AffinitizedThreadpool
Initiate IOs to the current CPU’s thread.
impl Initiate for AffinitizedThreadpool
Initiate IOs to the current CPU’s thread.