pub struct ThreadPool { /* private fields */ }Expand description
Thread pool for parallel execution
Implementations§
Source§impl ThreadPool
impl ThreadPool
Sourcepub fn with_config(config: ThreadPoolConfig) -> Self
pub fn with_config(config: ThreadPoolConfig) -> Self
Create a new thread pool with custom configuration
Sourcepub fn execute<F>(&self, f: F) -> Result<(), ThreadPoolError>
pub fn execute<F>(&self, f: F) -> Result<(), ThreadPoolError>
Execute a closure on the thread pool
Sourcepub fn execute_and_wait<F, R>(&self, f: F) -> Result<R, ThreadPoolError>
pub fn execute_and_wait<F, R>(&self, f: F) -> Result<R, ThreadPoolError>
Execute a closure and wait for completion
Sourcepub fn execute_parallel<F, I>(
&self,
tasks: I,
) -> Result<Vec<()>, ThreadPoolError>
pub fn execute_parallel<F, I>( &self, tasks: I, ) -> Result<Vec<()>, ThreadPoolError>
Execute multiple tasks in parallel
Sourcepub fn get_stats(&self) -> ThreadPoolStats
pub fn get_stats(&self) -> ThreadPoolStats
Get thread pool statistics
Sourcepub fn get_config(&self) -> &ThreadPoolConfig
pub fn get_config(&self) -> &ThreadPoolConfig
Get current configuration
Sourcepub fn shutdown(self) -> Result<(), ThreadPoolError>
pub fn shutdown(self) -> Result<(), ThreadPoolError>
Shutdown the thread pool gracefully
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 UnsafeUnpin 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