tokio/runtime/
config.rs

1#![cfg_attr(
2    any(not(all(tokio_unstable, feature = "full")), target_family = "wasm"),
3    allow(dead_code)
4)]
5use crate::runtime::{Callback, TaskCallback};
6use crate::util::RngSeedGenerator;
7
8pub(crate) struct Config {
9    /// How many ticks before pulling a task from the global/remote queue?
10    pub(crate) global_queue_interval: Option<u32>,
11
12    /// How many ticks before yielding to the driver for timer and I/O events?
13    pub(crate) event_interval: u32,
14
15    /// How big to make each worker's local queue
16    pub(crate) local_queue_capacity: usize,
17
18    /// Callback for a worker parking itself
19    pub(crate) before_park: Option<Callback>,
20
21    /// Callback for a worker unparking itself
22    pub(crate) after_unpark: Option<Callback>,
23
24    /// To run before each task is spawned.
25    pub(crate) before_spawn: Option<TaskCallback>,
26
27    /// To run after each task is terminated.
28    pub(crate) after_termination: Option<TaskCallback>,
29
30    /// The multi-threaded scheduler includes a per-worker LIFO slot used to
31    /// store the last scheduled task. This can improve certain usage patterns,
32    /// especially message passing between tasks. However, this LIFO slot is not
33    /// currently stealable.
34    ///
35    /// Eventually, the LIFO slot **will** become stealable, however as a
36    /// stop-gap, this unstable option lets users disable the LIFO task.
37    pub(crate) disable_lifo_slot: bool,
38
39    /// Random number generator seed to configure runtimes to act in a
40    /// deterministic way.
41    pub(crate) seed_generator: RngSeedGenerator,
42
43    /// How to build poll time histograms
44    pub(crate) metrics_poll_count_histogram: Option<crate::runtime::HistogramBuilder>,
45
46    #[cfg(tokio_unstable)]
47    /// How to respond to unhandled task panics.
48    pub(crate) unhandled_panic: crate::runtime::UnhandledPanic,
49}