Struct rayon_core::scope::ScopeBase
source · struct ScopeBase<'scope> {
registry: Arc<Registry>,
panic: AtomicPtr<Box<dyn Any + Send + 'static>>,
job_completed_latch: CountLatch,
marker: PhantomData<Box<dyn FnOnce(&Scope<'scope>) + Send + Sync + 'scope>>,
}
Fields§
§registry: Arc<Registry>
thread registry where scope()
was executed or where in_place_scope()
should spawn jobs.
panic: AtomicPtr<Box<dyn Any + Send + 'static>>
if some job panicked, the error is stored here; it will be propagated to the one who created the scope
job_completed_latch: CountLatch
latch to track job counts
marker: PhantomData<Box<dyn FnOnce(&Scope<'scope>) + Send + Sync + 'scope>>
You can think of a scope as containing a list of closures to execute,
all of which outlive 'scope
. They’re not actually required to be
Sync
, but it’s still safe to let the Scope
implement Sync
because
the closures are only moved across threads to be executed.
Implementations§
source§impl<'scope> ScopeBase<'scope>
impl<'scope> ScopeBase<'scope>
sourcefn new(owner: Option<&WorkerThread>, registry: Option<&Arc<Registry>>) -> Self
fn new(owner: Option<&WorkerThread>, registry: Option<&Arc<Registry>>) -> Self
Creates the base of a new scope for the given registry
fn heap_job_ref<FUNC>(&self, job: Box<HeapJob<FUNC>>) -> JobRef
fn inject_broadcast<FUNC>(&self, job: Arc<ArcJob<FUNC>>)
sourcefn complete<FUNC, R>(&self, owner: Option<&WorkerThread>, func: FUNC) -> Rwhere
FUNC: FnOnce() -> R,
fn complete<FUNC, R>(&self, owner: Option<&WorkerThread>, func: FUNC) -> Rwhere
FUNC: FnOnce() -> R,
Executes func
as a job, either aborting or executing as
appropriate.
sourceunsafe fn execute_job<FUNC>(this: *const Self, func: FUNC)where
FUNC: FnOnce(),
unsafe fn execute_job<FUNC>(this: *const Self, func: FUNC)where
FUNC: FnOnce(),
Executes func
as a job, either aborting or executing as
appropriate.
sourceunsafe fn execute_job_closure<FUNC, R>(
this: *const Self,
func: FUNC,
) -> Option<R>where
FUNC: FnOnce() -> R,
unsafe fn execute_job_closure<FUNC, R>(
this: *const Self,
func: FUNC,
) -> Option<R>where
FUNC: FnOnce() -> R,
Executes func
as a job in scope. Adjusts the “job completed”
counters and also catches any panic and stores it into
scope
.