Struct rayon_core::registry::WorkerThread
source · pub(crate) struct WorkerThread {
worker: Worker<JobRef>,
stealer: Stealer<JobRef>,
fifo: JobFifo,
index: usize,
rng: XorShift64Star,
registry: Arc<Registry>,
}
Expand description
//////////////////////////////////////////////////////////////////////// WorkerThread identifiers
Fields§
§worker: Worker<JobRef>
the “worker” half of our local deque
stealer: Stealer<JobRef>
the “stealer” half of the worker’s broadcast deque
fifo: JobFifo
local queue used for spawn_fifo
indirection
index: usize
§rng: XorShift64Star
A weak random number generator.
registry: Arc<Registry>
Implementations§
source§impl WorkerThread
impl WorkerThread
sourcepub(crate) fn current() -> *const WorkerThread
pub(crate) fn current() -> *const WorkerThread
Gets the WorkerThread
index for the current thread; returns
NULL if this is not a worker thread. This pointer is valid
anywhere on the current thread.
sourceunsafe fn set_current(thread: *const WorkerThread)
unsafe fn set_current(thread: *const WorkerThread)
Sets self
as the worker thread index for the current thread.
This is done during worker thread startup.
sourcepub(crate) fn registry(&self) -> &Arc<Registry>
pub(crate) fn registry(&self) -> &Arc<Registry>
Returns the registry that owns this worker thread.
sourcepub(crate) fn index(&self) -> usize
pub(crate) fn index(&self) -> usize
Our index amongst the worker threads (ranges from 0..self.num_threads()
).
pub(crate) unsafe fn push(&self, job: JobRef)
pub(crate) unsafe fn push_fifo(&self, job: JobRef)
pub(crate) fn local_deque_is_empty(&self) -> bool
sourcepub(crate) fn take_local_job(&self) -> Option<JobRef>
pub(crate) fn take_local_job(&self) -> Option<JobRef>
Attempts to obtain a “local” job – typically this means popping from the top of the stack, though if we are configured for breadth-first execution, it would mean dequeuing from the bottom.
fn has_injected_job(&self) -> bool
sourcepub(crate) unsafe fn wait_until<L: AsCoreLatch + ?Sized>(&self, latch: &L)
pub(crate) unsafe fn wait_until<L: AsCoreLatch + ?Sized>(&self, latch: &L)
Wait until the latch is set. Try to keep busy by popping and stealing tasks as necessary.