Struct scoped_pool::Scope [] [src]

pub struct Scope<'scope> { /* fields omitted */ }

An execution scope, represents a set of jobs running on a Pool.

Understanding Scope lifetimes

Besides Scope<'static>, all Scope objects are accessed behind a reference of the form &'scheduler Scope<'scope>.

'scheduler is the lifetime associated with the body of the "scheduler" function (functions passed to zoom/scoped).

'scope is the lifetime which data captured in execute or recurse closures must outlive - in other words, 'scope is the maximum lifetime of all jobs scheduler on a Scope.

Note that since 'scope: 'scheduler ('scope outlives 'scheduler) &'scheduler Scope<'scope> can't be captured in an execute closure; this is the reason for the existence of the recurse API, which will inject the same scope with a new 'scheduler lifetime (this time set to the body of the function passed to recurse).

Methods

impl<'scope> Scope<'scope>
[src]

Create a Scope which lasts forever.

Add a job to this scope.

Subsequent calls to join will wait for this job to complete.

Add a job to this scope which itself will get access to the scope.

Like with execute, subsequent calls to join will wait for this job (and all jobs scheduled on the scope it receives) to complete.

Create a new subscope, bound to a lifetime smaller than our existing Scope.

The subscope has a different job set, and is joined before zoom returns.

Awaits all jobs submitted on this Scope to be completed.

Only guaranteed to join jobs which where executed logically prior to join. Jobs executed concurrently with join may or may not be completed before join returns.