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<SchedulingPolicy, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SchedulingPolicy, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for SchedulingPolicy
Source§impl PartialEq for SchedulingPolicy
impl PartialEq for SchedulingPolicy
Source§impl Serialize for SchedulingPolicy
impl Serialize for SchedulingPolicy
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
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>,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
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