pub enum SchedulingPolicy {
Fair,
Nice(i8),
Fifo {
priority: u8,
},
RoundRobin {
priority: u8,
},
}Expand description
Scheduling policy applied to every worker thread of a ThreadPoolConfig.
On Linux these map directly onto the POSIX scheduling policies. On other
platforms they are applied best-effort (see the per-pool
ThreadPoolConfig::on_error behavior).
Variants§
Fair
Normal fair time-sharing scheduler (SCHED_OTHER/CFS on Linux) with default
niceness. The OS shares the CPU fairly across threads and no thread starves.
Use for everything that isn’t latency-critical. This is the default.
Nice(i8)
Fair scheduler with an explicit niceness (-20..=19, lower is more favorable).
A soft priority hint, not a guarantee: a higher (nicer) value yields the CPU
more readily. Use to bias a pool below or above normal work without leaving
the fair scheduler — e.g. Nice(10) for heavy background work that should
step aside for the control loop.
Fifo
SCHED_FIFO real-time policy, priority 1..=99 (higher wins).
Hard real-time: a FIFO thread runs ahead of every fair thread and is not
time-sliced — it runs until it blocks or a higher-priority RT thread preempts
it. Use for the latency-critical pipeline, and pin it with affinity so a
busy worker cannot starve other work on the same core. Linux-only; typically
needs CAP_SYS_NICE.
RoundRobin
SCHED_RR real-time policy, priority 1..=99 (higher wins).
Same real-time semantics as Fifo, except threads at the same
priority are round-robin time-sliced rather than run-to-block. Use when
several RT workers share a priority and should interleave fairly. Linux-only;
typically needs CAP_SYS_NICE.
Trait Implementations§
Source§impl Clone for SchedulingPolicy
impl Clone for SchedulingPolicy
Source§fn clone(&self) -> SchedulingPolicy
fn clone(&self) -> SchedulingPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SchedulingPolicy
Source§impl Debug for SchedulingPolicy
impl Debug for SchedulingPolicy
Source§impl Default for SchedulingPolicy
impl Default for SchedulingPolicy
Source§fn default() -> SchedulingPolicy
fn default() -> SchedulingPolicy
Source§impl<'de> Deserialize<'de> for SchedulingPolicy
impl<'de> Deserialize<'de> for SchedulingPolicy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for SchedulingPolicy
Source§impl PartialEq for SchedulingPolicy
impl PartialEq for SchedulingPolicy
Source§fn eq(&self, other: &SchedulingPolicy) -> bool
fn eq(&self, other: &SchedulingPolicy) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for SchedulingPolicy
impl Serialize for SchedulingPolicy
impl StructuralPartialEq for SchedulingPolicy
Auto Trait Implementations§
impl Freeze for SchedulingPolicy
impl RefUnwindSafe for SchedulingPolicy
impl Send for SchedulingPolicy
impl Sync for SchedulingPolicy
impl Unpin for SchedulingPolicy
impl UnsafeUnpin for SchedulingPolicy
impl UnwindSafe for SchedulingPolicy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> GetTypeRegistration for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more