Struct rayon::ThreadPool [] [src]

pub struct ThreadPool { /* fields omitted */ }

Methods

impl ThreadPool
[src]

Constructs a new thread pool with the given configuration. If the configuration is not valid, returns a suitable Err result. See InitError for more details.

Executes op within the threadpool. Any attempts to join which occur there will then operate within that threadpool.

Returns the number of threads in the thread pool.

If called from a Rayon worker thread in this thread-pool, returns the index of that thread; if not called from a Rayon thread, or called from a Rayon thread that belongs to a different thread-pool, returns None.

The index for a given thread will not change over the thread's lifetime. However, multiple threads may share the same index if they are in distinct thread-pools.

Future compatibility note

Currently, every thread-pool (including the global thread-pool) has a fixed number of threads, but this may change in future Rayon versions. In that case, the index for a thread would not change during its lifetime, but thread indices may wind up being reused if threads are terminated and restarted. (If this winds up being an untenable policy, then a semver-incompatible version can be used.)

Trait Implementations

impl Drop for ThreadPool
[src]

A method called when the value goes out of scope. Read more