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

source

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.

source

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.

source

pub(crate) fn registry(&self) -> &Arc<Registry>

Returns the registry that owns this worker thread.

source

pub(crate) fn index(&self) -> usize

Our index amongst the worker threads (ranges from 0..self.num_threads()).

source

pub(crate) unsafe fn push(&self, job: JobRef)

source

pub(crate) unsafe fn push_fifo(&self, job: JobRef)

source

pub(crate) fn local_deque_is_empty(&self) -> bool

source

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.

source

fn has_injected_job(&self) -> bool

source

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.

source

unsafe fn wait_until_cold(&self, latch: &CoreLatch)

source

unsafe fn wait_until_out_of_work(&self)

source

fn find_work(&self) -> Option<JobRef>

source

pub(crate) fn yield_now(&self) -> Yield

source

pub(crate) fn yield_local(&self) -> Yield

source

pub(crate) unsafe fn execute(&self, job: JobRef)

source

fn steal(&self) -> Option<JobRef>

Try to steal a single job and return it.

This should only be done as a last resort, when there is no local work to do.

Trait Implementations§

source§

impl Drop for WorkerThread

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl From<ThreadBuilder> for WorkerThread

source§

fn from(thread: ThreadBuilder) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
source§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.