pub(crate) struct WorkerThread {
worker: Worker<JobRef>,
stealer: Stealer<JobRef>,
fifo: JobFifo,
pub(crate) index: usize,
rng: XorShift64Star,
pub(crate) 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.
pub(crate) 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.
unsafe fn wait_until_cold(&self, latch: &CoreLatch)
unsafe fn wait_until_out_of_work(&self)
fn find_work(&self) -> Option<JobRef>
pub(crate) fn yield_now(&self) -> Yield
pub(crate) fn yield_local(&self) -> Yield
pub(crate) unsafe fn execute(&self, job: JobRef)
Trait Implementations§
Source§impl Drop for WorkerThread
impl Drop for WorkerThread
Source§impl From<ThreadBuilder> for WorkerThread
impl From<ThreadBuilder> for WorkerThread
Source§fn from(thread: ThreadBuilder) -> Self
fn from(thread: ThreadBuilder) -> Self
Auto Trait Implementations§
impl !Freeze for WorkerThread
impl !RefUnwindSafe for WorkerThread
impl Send for WorkerThread
impl !Sync for WorkerThread
impl Unpin for WorkerThread
impl !UnwindSafe for WorkerThread
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: 384 bytes