Struct yatp::pool::Builder[][src]

pub struct Builder { /* fields omitted */ }

A builder for the thread pool.

Implementations

impl Builder[src]

pub fn new(name_prefix: impl Into<String>) -> Builder[src]

Create a builder using the given name prefix.

pub fn max_thread_count(&mut self, count: usize) -> &mut Self[src]

Sets the maximum number of running threads at the same time.

pub fn min_thread_count(&mut self, count: usize) -> &mut Self[src]

Sets the minimum number of running threads at the same time.

pub fn max_inplace_spin(&mut self, count: usize) -> &mut Self[src]

Sets the maximum tries to rerun an unfinished task before pushing back to queue.

pub fn max_idle_time(&mut self, time: Duration) -> &mut Self[src]

Sets the maximum allowed idle time for a thread. Thread will only be woken up when algorithm thinks it needs more worker.

pub fn max_wait_time(&mut self, time: Duration) -> &mut Self[src]

Sets the maximum time to wait for a task before increasing the running thread slots.

pub fn wake_backoff(&mut self, time: Duration) -> &mut Self[src]

Sets the minimum interval between waking a thread.

pub fn alloc_slot_backoff(&mut self, time: Duration) -> &mut Self[src]

Sets the minimum interval between increasing running threads.

pub fn stack_size(&mut self, size: usize) -> &mut Self[src]

Sets the stack size of the spawned threads.

pub fn freeze<T>(&self) -> (Remote<T>, LazyBuilder<T>) where
    T: TaskCell + Send
[src]

Freezes the configurations and returns the task scheduler and a builder to for lazy spawning threads.

It internally uses single level queue to setup the pool.

In some cases, especially building up a large application, a task scheduler is required before spawning new threads. You can use this to separate the construction and starting.

pub fn freeze_with_queue<T>(
    &self,
    queue_type: QueueType
) -> (Remote<T>, LazyBuilder<T>) where
    T: TaskCell + Send
[src]

Freezes the configurations and returns the task scheduler and a builder to for lazy spawning threads.

queue_builder is a closure that creates a task queue. It accepts the number of local queues and returns the task injector and local queues.

In some cases, especially building up a large application, a task scheduler is required before spawning new threads. You can use this to separate the construction and starting.

pub fn build_callback_pool(&self) -> ThreadPool<TaskCell>[src]

Spawns a callback pool.

It setups the pool with single level queue.

pub fn build_future_pool(&self) -> ThreadPool<TaskCell>[src]

Spawns a future pool.

It setups the pool with single level queue.

pub fn build_multilevel_future_pool(&self) -> ThreadPool<TaskCell>[src]

Spawns a multilevel future pool.

It setups the pool with multi level queue.

pub fn build_with_queue_and_runner<T, B>(
    &self,
    queue_type: QueueType,
    runner_builder: B
) -> ThreadPool<T> where
    T: TaskCell + Send + 'static,
    B: RunnerBuilder,
    B::Runner: Runner<TaskCell = T> + Send + 'static, 
[src]

Spawns the thread pool immediately.

queue_builder is a closure that creates a task queue. It accepts the number of local queues and returns the task injector and local queues.

Trait Implementations

impl Clone for Builder[src]

Auto Trait Implementations

impl RefUnwindSafe for Builder

impl Send for Builder

impl Sync for Builder

impl Unpin for Builder

impl UnwindSafe for Builder

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]