pub(crate) struct Config {
pub(crate) global_queue_interval: Option<u32>,
pub(crate) event_interval: u32,
pub(crate) before_park: Option<Arc<dyn Fn() + Send + Sync>>,
pub(crate) after_unpark: Option<Arc<dyn Fn() + Send + Sync>>,
pub(crate) before_spawn: Option<Arc<dyn Fn(&TaskMeta<'_>) + Send + Sync>>,
pub(crate) after_termination: Option<Arc<dyn Fn(&TaskMeta<'_>) + Send + Sync>>,
pub(crate) disable_lifo_slot: bool,
pub(crate) seed_generator: RngSeedGenerator,
pub(crate) metrics_poll_count_histogram: Option<HistogramBuilder>,
pub(crate) enable_eager_driver_handoff: bool,
}Fields§
§global_queue_interval: Option<u32>How many ticks before pulling a task from the global/remote queue?
event_interval: u32How many ticks before yielding to the driver for timer and I/O events?
before_park: Option<Arc<dyn Fn() + Send + Sync>>Callback for a worker parking itself
after_unpark: Option<Arc<dyn Fn() + Send + Sync>>Callback for a worker unparking itself
before_spawn: Option<Arc<dyn Fn(&TaskMeta<'_>) + Send + Sync>>To run before each task is spawned.
after_termination: Option<Arc<dyn Fn(&TaskMeta<'_>) + Send + Sync>>To run after each task is terminated.
disable_lifo_slot: boolThe multi-threaded scheduler includes a per-worker LIFO slot used to store the last scheduled task. This can improve certain usage patterns, especially message passing between tasks.
In Tokio versions before 1.51, tasks in the LIFO slot could not be stolen, which could cause issues in applications with long poll times. As a stop-gap, this unstable option lets users disable the LIFO task. Now that the LIFO slot is stealable, we may remove this option in a future version.
seed_generator: RngSeedGeneratorRandom number generator seed to configure runtimes to act in a deterministic way.
metrics_poll_count_histogram: Option<HistogramBuilder>How to build poll time histograms
enable_eager_driver_handoff: boolIf true, an idle worker is woken whenever a worker thread transitions
from polling the I/O driver to polling its own tasks (requires
tokio_unstable).