Struct workpool::dynamic_pool::DynamicPool
source · pub struct DynamicPool<I, W, R>where
W: Worker<I>,
R: Reducer<W::Output>,{ /* private fields */ }
Expand description
DynamicPool is a Pool that can dynamically adjust the number of threads at runtime.
Implementations§
source§impl<I, W, R> DynamicPool<I, W, R>where
I: Send + 'static,
W: Worker<I> + Send + Sync + 'static,
W::Output: Send,
R: Reducer<W::Output> + Send + 'static,
R::Output: Send + Sync,
impl<I, W, R> DynamicPool<I, W, R>where I: Send + 'static, W: Worker<I> + Send + Sync + 'static, W::Output: Send, R: Reducer<W::Output> + Send + 'static, R::Output: Send + Sync,
sourcepub fn set_concurrency_limit(&self, concurrency_limit: i64)
pub fn set_concurrency_limit(&self, concurrency_limit: i64)
Adjust the concurrency_limit. Only this many work items will be processed concurrently. If the pool is currently processing more than the new limit’s amount of work the current work will finish processing until the amount of concurrenct work drops below the new threshold.
sourcepub fn wait_handle(self) -> WaitHandle<R::Output>
pub fn wait_handle(self) -> WaitHandle<R::Output>
Return a wait handle. This indicates that no new work will be added to the pool and wait() can be invoked on the returned handle to wait for all input to be processed and retrieve the output value.