pub struct ThreadpoolDriver { /* private fields */ }Expand description
A driver for AffinitizedThreadpool that is targeted at a specific
CPU.
Implementations§
Source§impl ThreadpoolDriver
impl ThreadpoolDriver
Sourcepub fn target_cpu(&self) -> u32
pub fn target_cpu(&self) -> u32
Returns the target CPU number for this thread.
This may be different from the CPU tasks actually run on if the affinity has not yet been set for the thread.
Sourcepub fn is_affinity_set(&self) -> bool
pub fn is_affinity_set(&self) -> bool
Returns whether this thread’s CPU affinity has been set to the intended CPU.
Sourcepub async fn wait_for_affinity(&self)
pub async fn wait_for_affinity(&self)
Waits for the affinity to be set to this thread’s intended CPU. If the
CPU was not online when the thread was created, then this will block
until the CPU is online and someone calls try_set_affinity.
Sourcepub fn set_spawn_notifier<F: 'static + Send + FnOnce(bool)>(
&self,
f: F,
) -> Result<(), F>
pub fn set_spawn_notifier<F: 'static + Send + FnOnce(bool)>( &self, f: F, ) -> Result<(), F>
Sets a function to be called when the thread gets spawned. The function
accepts a single bool parameter that indicates that the notifier
should cancel any oustanding run or not. When called by the threadpool,
the function will recieve true.
Return Err(f) if the thread is already spawned.
Trait Implementations§
Source§impl Clone for ThreadpoolDriver
impl Clone for ThreadpoolDriver
Source§fn clone(&self) -> ThreadpoolDriver
fn clone(&self) -> ThreadpoolDriver
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more