pub enum FastCasPolicy {
Once,
Spin {
max_attempts: u32,
},
SpinYield {
spin_attempts: u32,
max_attempts: u32,
},
}Expand description
Retry policy used by crate::FastCas when compare-and-swap loses a race.
Variants§
Once
Try the operation once and return conflict on the first failed CAS.
Spin
Retry immediately until CAS succeeds, the operation aborts, or the attempt budget is exhausted.
SpinYield
Spin for a short prefix, then yield between retries until the attempt budget is exhausted.
Implementations§
Source§impl FastCasPolicy
impl FastCasPolicy
Sourcepub const fn once() -> FastCasPolicy
pub const fn once() -> FastCasPolicy
Sourcepub const fn spin(max_attempts: u32) -> FastCasPolicy
pub const fn spin(max_attempts: u32) -> FastCasPolicy
Sourcepub const fn spin_yield(spin_attempts: u32, max_attempts: u32) -> FastCasPolicy
pub const fn spin_yield(spin_attempts: u32, max_attempts: u32) -> FastCasPolicy
Sourcepub const fn max_attempts(self) -> u32
pub const fn max_attempts(self) -> u32
Trait Implementations§
Source§impl Clone for FastCasPolicy
impl Clone for FastCasPolicy
Source§fn clone(&self) -> FastCasPolicy
fn clone(&self) -> FastCasPolicy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FastCasPolicy
impl Debug for FastCasPolicy
Source§impl PartialEq for FastCasPolicy
impl PartialEq for FastCasPolicy
Source§fn eq(&self, other: &FastCasPolicy) -> bool
fn eq(&self, other: &FastCasPolicy) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for FastCasPolicy
impl Eq for FastCasPolicy
impl StructuralPartialEq for FastCasPolicy
Auto Trait Implementations§
impl Freeze for FastCasPolicy
impl RefUnwindSafe for FastCasPolicy
impl Send for FastCasPolicy
impl Sync for FastCasPolicy
impl Unpin for FastCasPolicy
impl UnsafeUnpin for FastCasPolicy
impl UnwindSafe for FastCasPolicy
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
Mutably borrows from an owned value. Read more