pub struct AtomicPtr<T>(/* private fields */);Expand description
Creusot wrapper around std::sync::atomic::AtomicPtr.
Implementations§
Source§impl<T> AtomicPtr<T>
impl<T> AtomicPtr<T>
Sourcepub fn new(
val: *mut T,
view: Ghost<&mut SyncView>,
) -> (Self, Ghost<Box<Perm<AtomicPtr<T>>>>)
pub fn new( val: *mut T, view: Ghost<&mut SyncView>, ) -> (Self, Ghost<Box<Perm<AtomicPtr<T>>>>)
ensures
*result.1.val() == FMap::singleton(result.0.get_timestamp(^view), (val, **view))
ensures
*result.1.ward() == result.0terminates
Sourcepub fn load<F>(&self, f: Ghost<F>) -> *mut T
pub fn load<F>(&self, f: Ghost<F>) -> *mut T
Wrapper for std::sync::atomic::AtomicPtr::load.
requires
forall<c: &LoadCommitter<$type, Self>> c.ward() == *self ==> f.precondition((c,))
ensures
exists<c: &LoadCommitter<$type, Self>> c.ward() == *self && c.val() == result && f.postcondition_once((c,), ())
Sourcepub fn store<F>(&self, val: *mut T, f: Ghost<F>)
pub fn store<F>(&self, val: *mut T, f: Ghost<F>)
Wrapper for std::sync::atomic::AtomicPtr::store.
requires
forall<c: &mut StoreCommitter<$type, Self>> !c.shot() ==> c.ward() == *self ==> c.val() == val ==> f.precondition((c,)) && f.postcondition_once((c,), ()) ==> (^c).shot()
ensures
exists<c: &mut StoreCommitter<$type, Self>> !c.shot() && c.ward() == *self && c.val() == val && f.postcondition_once((c,), ())
Trait Implementations§
Source§impl<T> HasTimestamp for AtomicPtr<T>
impl<T> HasTimestamp for AtomicPtr<T>
Source§fn get_timestamp(self, _: SyncView) -> Timestamp
fn get_timestamp(self, _: SyncView) -> Timestamp
logic(opaque) ⚠
Source§fn get_timestamp_monotonic(self, x: SyncView, y: SyncView)
fn get_timestamp_monotonic(self, x: SyncView, y: SyncView)
logic(law) ⚠
requires
x.le_log(y)ensures
self.get_timestamp(x).le_log(self.get_timestamp(y))Auto Trait Implementations§
impl<T> !Freeze for AtomicPtr<T>
impl<T> Objective for AtomicPtr<T>where
T: Objective,
impl<T> RefUnwindSafe for AtomicPtr<T>
impl<T> Send for AtomicPtr<T>
impl<T> Sync for AtomicPtr<T>
impl<T> Unpin for AtomicPtr<T>
impl<T> UnsafeUnpin for AtomicPtr<T>
impl<T> UnwindSafe for AtomicPtr<T>where
T: RefUnwindSafe,
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