A helper struct to aid creating a new
ThreadPool using default values where no value was
Create a new
Specify the name of the
ThreadPool that will be used as prefix for the name of each worker thread.
By default the name is "rusty_pool_x" with x being a static pool counter.
Specify the core pool size for the
ThreadPool. The core pool size is the number of threads that stay alive
for the entire lifetime of the
ThreadPool or, to be more precise, its channel. These threads are spawned if
a task is submitted to the
ThreadPool and the current worker count is below the core pool size.
Specify the maximum pool size this
ThreadPool may scale up to. This numbers represents the maximum number
of threads that may be alive at the same time within this pool. Additional threads above the core pool size
only remain idle for the duration specified by the
keep_alive parameter before terminating. If the core pool
is full, the current pool size is below the max size and there are no idle threads then additional threads
will be spawned.
pub fn keep_alive(self, keep_alive: Duration) -> Builder[src]
Specify the duration for which additional threads outside the core pool remain alive while not receiving any work before giving up and terminating.
pub fn build(self) -> ThreadPool[src]
ThreadPool using the parameters previously supplied to this
Builder using the number of CPUs as
default core size if none provided, 4 times the core size as max size if none provided, 60 seconds keep_alive
if none provided and the default naming if none provided. This function calls
ThreadPool::new_named depending on whether a name was provided.
Building might panic if the
max_size is 0 or lower than
impl RefUnwindSafe for Builder
impl UnwindSafe for Builder
type Error = Infallible
The type returned in the event of a conversion error.