struct Core {
tick: u32,
lifo_enabled: bool,
run_queue: Local<Arc<Handle>>,
is_searching: bool,
is_shutdown: bool,
is_traced: bool,
had_driver: HadDriver,
enable_eager_driver_handoff: bool,
park: Option<Parker>,
stats: Stats,
global_queue_interval: u32,
rand: FastRand,
}Expand description
Core data
Fields§
§tick: u32Used to schedule bookkeeping tasks every so often.
lifo_enabled: boolWhen true, locally scheduled tasks go to the LIFO slot. When false,
they go to the back of the run_queue.
run_queue: Local<Arc<Handle>>The worker-local run queue.
is_searching: boolTrue if the worker is currently searching for more work. Searching involves attempting to steal from other workers.
is_shutdown: boolTrue if the scheduler is being shutdown
is_traced: boolTrue if the scheduler is being traced
had_driver: HadDriverWhether or not the worker has just returned from a park in which we parked on the I/O driver.
enable_eager_driver_handoff: boolIf true, the worker should eagerly notify another worker when polling
the first task after returning from a park in which it parked on the I/O
or time driver.
park: Option<Parker>Parker
Stored in an Option as the parker is added / removed to make the
borrow checker happy.
stats: StatsPer-worker runtime stats
global_queue_interval: u32How often to check the global queue
rand: FastRandFast random number generator.
Implementations§
Source§impl Core
impl Core
Sourcefn next_task(&mut self, worker: &Worker) -> Option<Notified<Arc<Handle>>>
fn next_task(&mut self, worker: &Worker) -> Option<Notified<Arc<Handle>>>
Return the next notified task available to this worker.
fn next_local_task(&mut self) -> Option<Notified<Arc<Handle>>>
Sourcefn steal_work(&mut self, worker: &Worker) -> Option<Notified<Arc<Handle>>>
fn steal_work(&mut self, worker: &Worker) -> Option<Notified<Arc<Handle>>>
Function responsible for stealing tasks from another worker
Note: Only if less than half the workers are searching for tasks to steal a new worker will actually try to steal. The idea is to make sure not all workers will be trying to steal at the same time.
fn transition_to_searching(&mut self, worker: &Worker) -> bool
fn transition_from_searching(&mut self, worker: &Worker) -> bool
fn has_tasks(&self) -> bool
fn should_notify_others(&self) -> bool
Sourcefn transition_to_parked(&mut self, worker: &Worker) -> bool
fn transition_to_parked(&mut self, worker: &Worker) -> bool
Prepares the worker state for parking.
Returns true if the transition happened, false if there is work to do first.
Sourcefn transition_from_parked(&mut self, worker: &Worker) -> bool
fn transition_from_parked(&mut self, worker: &Worker) -> bool
Returns true if the transition happened.
Sourcefn maintenance(&mut self, worker: &Worker)
fn maintenance(&mut self, worker: &Worker)
Runs maintenance work such as checking the pool’s state.
Sourcefn pre_shutdown(&mut self, worker: &Worker)
fn pre_shutdown(&mut self, worker: &Worker)
Signals all tasks to shut down, and waits for them to complete. Must run before we enter the single-threaded phase of shutdown processing.