Struct yatp::pool::Builder [−][src]
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]
T: TaskCell + Send,
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]
&self,
queue_type: QueueType
) -> (Remote<T>, LazyBuilder<T>) where
T: TaskCell + Send,
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]
&self,
queue_type: QueueType,
runner_builder: B
) -> ThreadPool<T> where
T: TaskCell + Send + 'static,
B: RunnerBuilder,
B::Runner: Runner<TaskCell = T> + Send + 'static,
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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,