Struct stronghold_rlu::breaker::BusyBreaker
source · [−]pub struct BusyBreaker { /* private fields */ }
Expand description
BusyBreaker
BusyBreaker
is kind of a circuit-breaker and busy keeper for short delays on spin loops on the CPU.
Example
Implementations
sourceimpl BusyBreaker
impl BusyBreaker
sourcepub fn new(max_trips: usize) -> Self
pub fn new(max_trips: usize) -> Self
Creates a new BusyBreaker
with a configurable number
of exponential trips before the breaker trips. In the latter
case an error is being returned.
sourcepub fn spin(&self) -> Result<(), BusyBreakerError>
pub fn spin(&self) -> Result<(), BusyBreakerError>
Keeps the CPU busy but hints to the CPU reschedule the CPU time
core::hint::spin_loop()
may be available on the integrating system,
otherwise this function call is just a busy loop, that wastes some CPU cycles
Trait Implementations
sourceimpl Clone for BusyBreaker
impl Clone for BusyBreaker
Auto Trait Implementations
impl RefUnwindSafe for BusyBreaker
impl Send for BusyBreaker
impl Sync for BusyBreaker
impl Unpin for BusyBreaker
impl UnwindSafe for BusyBreaker
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more