pub struct ExecutorConfig {
pub total_threads_range: AtomicRangeStrict<AtomicUsize>,
pub temporary_threads_range: AtomicRangeStrict<AtomicUsize>,
/* private fields */
}Expand description
Configuration of Executor.
Fields§
§total_threads_range: AtomicRangeStrict<AtomicUsize>minimum..=maximum number of total executor threads.
temporary_threads_range: AtomicRangeStrict<AtomicUsize>maximum number of temporary executors. if setting to 0, it will disable preempt (spawn new temporary executor if too busy).
it is not recommended to disable this, due to Asyncute is designed for “hang-up-free”.
for example, if user runs blocking I/O or CPU-bound tasks in one of executor (or even many executors), then some new temporary executors will be spawn “as soon as busy”.
this is primacy different in “blocking handle” between Asyncute and Goroutine.
in Golang, if a goroutine is used for blocking, all of asynchronous IO poll tasks will be moved to a native OS thread other than the thread of blocking goroutine used to executes blocking operations. this is not essential, and make the design more complexity.
in Asyncute, if a Future is used for blocking, this is no problem! all other idle executors will continues to handle async tasks, and no move needed (due to asyncute does not have per-executor queues for working-stealing).
Implementations§
Source§impl ExecutorConfig
impl ExecutorConfig
Sourcepub const MIN_INTERVAL: Duration
pub const MIN_INTERVAL: Duration
the minimum interval of executor loop.
Sourcepub const MAX_INTERVAL: Duration
pub const MAX_INTERVAL: Duration
the maximum interval of executor loop.
Sourcepub fn set_interval(&self, val: Duration) -> bool
pub fn set_interval(&self, val: Duration) -> bool
set the executor interval.
Sourcepub fn spawn_policy(&self) -> ExecutorSpawnPolicy
pub fn spawn_policy(&self) -> ExecutorSpawnPolicy
get the executor spawn policy.
Sourcepub fn set_spawn_policy(&self, policy: ExecutorSpawnPolicy)
pub fn set_spawn_policy(&self, policy: ExecutorSpawnPolicy)
set the executor spawn policy.
Sourcepub fn overload_threshold(&self) -> f64
pub fn overload_threshold(&self) -> f64
get the threshold of overload.
Sourcepub fn set_overload_threshold(&self, val: f64) -> bool
pub fn set_overload_threshold(&self, val: f64) -> bool
set the threshold of overload.
Sourcepub fn standby_threshold(&self) -> f64
pub fn standby_threshold(&self) -> f64
get the threshold of standby.
Sourcepub fn set_standby_threshold(&self, val: f64) -> bool
pub fn set_standby_threshold(&self, val: f64) -> bool
set the threshold of standby.