Skip to main content

## Job

# Trait Job

Source

    pub(crate) trait Job {
        // Required method
        unsafe fn execute(this: *const ());
    }

Expand description

A `Job` is used to advertise work for other threads that they may want to steal. In accordance with time honored tradition, jobs are arranged in a deque, so that thieves can take from the top of the deque while the main worker manages the bottom of the deque. This deque is managed by the `thread_pool` module.

## Required Methods§

Source

#### unsafe fn execute(this: *const ())

Unsafe: this may be called from a different thread than the one which scheduled the job, so the implementer must ensure the appropriate traits are met, whether `Send`, `Sync`, or both.

## Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

## Implementors§

Source§

### impl Job for JobFifo

Source§

### impl<BODY> Job for ArcJob<BODY>
where BODY: Fn(JobRefId) + Send + Sync,

Source§

### impl<BODY> Job for HeapJob<BODY>
where BODY: FnOnce(JobRefId) + Send,

Source§

### impl<L, F, R> Job for StackJob<L, F, R>
where L: Latch + Sync, F: FnOnce(bool) -> R + Send, R: Send,