pub struct WorkerHandle { /* private fields */ }Expand description
Handle for a worker to interact with the scheduler.
Provides a simpler API for workers with integrated work-stealing.
Implementations§
Source§impl WorkerHandle
impl WorkerHandle
Sourcepub fn new(scheduler: Arc<MorselScheduler>) -> Self
pub fn new(scheduler: Arc<MorselScheduler>) -> Self
Creates a new worker handle and registers with the scheduler.
Sourcepub fn get_work(&self) -> Option<Morsel>
pub fn get_work(&self) -> Option<Morsel>
Gets the next morsel to process.
Tries: local queue -> global queue -> steal from others
Sourcepub fn push_local(&self, morsel: Morsel)
pub fn push_local(&self, morsel: Morsel)
Pushes a morsel to this worker’s local queue.
Sourcepub fn complete_morsel(&self)
pub fn complete_morsel(&self)
Marks the current morsel as complete.
Auto Trait Implementations§
impl !Freeze for WorkerHandle
impl !RefUnwindSafe for WorkerHandle
impl Send for WorkerHandle
impl !Sync for WorkerHandle
impl Unpin for WorkerHandle
impl !UnwindSafe for WorkerHandle
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
Mutably borrows from an owned value. Read more