Struct bevy_tasks::TaskPoolBuilder
source · pub struct TaskPoolBuilder { /* private fields */ }
Expand description
Used to create a TaskPool
Implementations§
source§impl TaskPoolBuilder
impl TaskPoolBuilder
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new TaskPoolBuilder
instance
sourcepub fn num_threads(self, num_threads: usize) -> Self
pub fn num_threads(self, num_threads: usize) -> Self
Override the number of threads created for the pool. If unset, we default to the number of logical cores of the system
sourcepub fn stack_size(self, stack_size: usize) -> Self
pub fn stack_size(self, stack_size: usize) -> Self
Override the stack size of the threads created for the pool
sourcepub fn thread_name(self, thread_name: String) -> Self
pub fn thread_name(self, thread_name: String) -> Self
Override the name of the threads created for the pool. If set, threads will
be named <thread_name> (<thread_index>)
, i.e. MyThreadPool (2)
sourcepub fn on_thread_spawn(self, f: impl Fn() + Send + Sync + 'static) -> Self
pub fn on_thread_spawn(self, f: impl Fn() + Send + Sync + 'static) -> Self
Sets a callback that is invoked once for every created thread as it starts.
This is called on the thread itself and has access to all thread-local storage. This will block running async tasks on the thread until the callback completes.
sourcepub fn on_thread_destroy(self, f: impl Fn() + Send + Sync + 'static) -> Self
pub fn on_thread_destroy(self, f: impl Fn() + Send + Sync + 'static) -> Self
Sets a callback that is invoked once for every created thread as it terminates.
This is called on the thread itself and has access to all thread-local storage. This will block thread termination until the callback completes.