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>>,
tlv: Tlv,
}
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.
tlv: Tlv
The TLV at the scope’s creation. Used to set the TLV for spawned jobs.
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
.
fn job_panicked(&self, err: Box<dyn Any + Send + 'static>)
fn maybe_propagate_panic(&self)
Auto Trait Implementations§
impl<'scope> !Freeze for ScopeBase<'scope>
impl<'scope> !RefUnwindSafe for ScopeBase<'scope>
impl<'scope> Send for ScopeBase<'scope>
impl<'scope> Sync for ScopeBase<'scope>
impl<'scope> Unpin for ScopeBase<'scope>
impl<'scope> !UnwindSafe for ScopeBase<'scope>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 56 bytes