Struct jobsteal::Pool [] [src]

pub struct Pool { /* fields omitted */ }

The work pool manages worker threads in a work-stealing fork-join thread pool.

You can submit jobs to the pool directly using Pool::submit. This has similar semantics to the standard library thread::spawn, in that the work provided must fully own its data.

Pool also provides a facility for spawning scoped jobs via the "scope" function.

Methods

impl Pool
[src]

Create a new spawning scope for submitting jobs.

This is shorthand for my_pool.spawner().scope(|scope| ...).

Any jobs submitted in this scope will be completed by the end of this function call. See Spawner::scope for a more detailed description.

Execute a job which strictly owns its contents and is to be given access to the thread pool.

The execution of this function may be deferred beyond this function call, to as far as either the next call to synchronize or the pool's destructor.

This is shorthand for my_pool.spawner().recurse(my_job);

Safety

In the general case, it is safe to submit jobs which only strictly outlive the pool. However, there is always the chance that the pool could be leaked, violating the invariant that the job is completed while its data is still alive.

Execute a job which strictly owns its contents.

The execution of this function may be deferred beyond this function call, to as far as either the next call to synchronize or the pool's destructor.

This is shorthand for my_pool.spawner().submit(my_job);

Safety

In the general case, it is safe to submit jobs which only strictly outlive the pool. However, there is always the chance that the pool could be leaked, violating the invariant that the job is completed while its data is still alive.

Get the pool's spawner.

This will initally only accept jobs which outive 'static, but the scope can be focused further. See the Spawner documentation for more information.

Trait Implementations

impl Drop for Pool
[src]

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