pub struct ThreadPool { /* private fields */ }Expand description
Thread pool with advanced features
Implementations§
Source§impl ThreadPool
impl ThreadPool
Sourcepub fn new(
num_threads: usize,
config: &WorkStealingConfig,
) -> IntegrateResult<Self>
pub fn new( num_threads: usize, config: &WorkStealingConfig, ) -> IntegrateResult<Self>
Create new thread pool
Sourcepub fn execute_tasks(
&self,
tasks: Vec<Box<dyn ParallelTask + Send>>,
) -> IntegrateResult<Vec<ParallelResult>>
pub fn execute_tasks( &self, tasks: Vec<Box<dyn ParallelTask + Send>>, ) -> IntegrateResult<Vec<ParallelResult>>
Execute tasks in parallel across worker threads
Sourcepub fn shutdown(&mut self) -> IntegrateResult<()>
pub fn shutdown(&mut self) -> IntegrateResult<()>
Shutdown the thread pool and wait for all threads to complete
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ThreadPool
impl !RefUnwindSafe for ThreadPool
impl Send for ThreadPool
impl Sync for ThreadPool
impl Unpin for ThreadPool
impl !UnwindSafe for ThreadPool
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more