- add
struct ThreadPoolBuilder
- add
ThreadPoolBuilder fn new()
- uses
num_cpu crate to default num of threads to num of cpus
- remove:
ThreadPool fn new(num_threads: usize) -> ThreadPool
- add:
ThreadPool fn new() -> ThreadPool
- uses
num_cpu to default num of threads to num of cpus
- add:
ThreadPoolBuilder fn num_threads(self, num: usize) -> ThreadPoolBuilder
- set the number of threads for the pool that the builder will construct
- remove:
ThreadPool fn with_name(name: String, num_threads: usize) -> ThreadPool
- add:
ThreadPoolBuilder fn name(self, name: String) -> ThreadPoolBuilder
- add:
ThreadPoolBuilder fn stack_size(self, size: usize) -> ThreadPoolBuilder
In summary: remove all constructors off of ThreadPool, except a new new constructor. If you want to fine-tune your threadpool, you'd use a ThreadPoolBuilder.
struct ThreadPoolBuilderThreadPoolBuilderfn new()num_cpucrate to default num of threads to num of cpusThreadPoolfn new(num_threads: usize) -> ThreadPoolThreadPoolfn new() -> ThreadPoolnum_cputo default num of threads to num of cpusThreadPoolBuilderfn num_threads(self, num: usize) -> ThreadPoolBuilderThreadPoolfn with_name(name: String, num_threads: usize) -> ThreadPoolThreadPoolBuilderfn name(self, name: String) -> ThreadPoolBuilderThreadPoolBuilderfn stack_size(self, size: usize) -> ThreadPoolBuilderIn summary: remove all constructors off of
ThreadPool, except a newnewconstructor. If you want to fine-tune your threadpool, you'd use aThreadPoolBuilder.