[−][src]Struct coco::epoch::Atomic
A tagged atomic nullable pointer.
The tag is stored into the unused least significant bits of the pointer. The pointer must be properly aligned.
Methods
impl<T> Atomic<T>
[src]
pub fn null(tag: usize) -> Self
[src]
Returns a new, null atomic pointer tagged with tag
.
Panics
Panics if the tag doesn't fit into the unused bits of an aligned pointer.
pub fn new(data: T, tag: usize) -> Self
[src]
Allocates data
on the heap and returns a new atomic pointer that points to it and is
tagged with tag
.
Panics
Panics if the tag doesn't fit into the unused bits of the pointer, or if the allocated pointer is unaligned.
pub fn from_ptr(ptr: Ptr<T>) -> Self
[src]
Returns a new atomic pointer initialized with ptr
.
pub fn from_box(b: Box<T>, tag: usize) -> Self
[src]
Returns a new atomic pointer initialized with b
and tag
.
Panics
Panics if the tag doesn't fit into the unused bits of the pointer, or if the pointer is unaligned.
pub unsafe fn from_raw(raw: *mut T, tag: usize) -> Self
[src]
Returns a new atomic pointer initialized with raw
and tag
.
Panics
Panics if the tag doesn't fit into the unused bits of the pointer, or if the pointer is unaligned.
pub fn load<'p>(&self, _: &'p Pin) -> Ptr<'p, T>
[src]
Loads the tagged atomic pointer.
This operation uses the Acquire
ordering.
pub fn load_raw(&self, order: Ordering) -> (*mut T, usize)
[src]
Loads the tagged atomic pointer as a raw pointer and a tag.
Argument order
describes the memory ordering of this operation.
pub fn store<'p>(&self, new: Ptr<'p, T>)
[src]
Stores new
tagged with tag
into the atomic.
This operation uses the Release
ordering.
pub fn store_box<'p>(&self, new: Box<T>, tag: usize, _: &'p Pin) -> Ptr<'p, T>
[src]
Stores new
tagged with tag
into the atomic and returns it.
This operation uses the Release
ordering.
Panics
Panics if the tag doesn't fit into the unused bits of the pointer, or if the pointer is unaligned.
pub unsafe fn store_raw<'p>(
&self,
new: *mut T,
tag: usize,
order: Ordering,
_: &'p Pin
) -> Ptr<'p, T>
[src]
&self,
new: *mut T,
tag: usize,
order: Ordering,
_: &'p Pin
) -> Ptr<'p, T>
Stores new
tagged with tag
into the atomic.
Argument order
describes the memory ordering of this operation.
Panics
Panics if the tag doesn't fit into the unused bits of the pointer, or if the pointer is unaligned.
pub fn swap<'p>(&self, new: Ptr<'p, T>) -> Ptr<'p, T>
[src]
Stores new
into the atomic, returning the old tagged pointer.
This operation uses the AcqRel
ordering.
pub fn swap_box<'p>(&self, new: Box<T>, tag: usize, _: &'p Pin) -> Ptr<'p, T>
[src]
Stores new
tagged with tag
into the atomic, returning the old tagged pointer.
This operation uses the AcqRel
ordering.
Panics
Panics if the tag doesn't fit into the unused bits of the pointer, or if the pointer is unaligned.
pub unsafe fn swap_raw<'p>(
&self,
new: *mut T,
tag: usize,
order: Ordering
) -> Ptr<'p, T>
[src]
&self,
new: *mut T,
tag: usize,
order: Ordering
) -> Ptr<'p, T>
Stores new
tagged with tag
into the atomic, returning the old tagged pointer.
Argument order
describes the memory ordering of this operation.
Panics
Panics if the tag doesn't fit into the unused bits of the pointer, or if the pointer is unaligned.
pub fn cas<'p>(
&self,
current: Ptr<'p, T>,
new: Ptr<'p, T>
) -> Result<(), Ptr<'p, T>>
[src]
&self,
current: Ptr<'p, T>,
new: Ptr<'p, T>
) -> Result<(), Ptr<'p, T>>
If the tagged atomic pointer is equal to current
, stores new
.
The return value is a result indicating whether the new pointer was stored. On failure the current value of the tagged atomic pointer is returned.
This operation uses the AcqRel
ordering.
pub fn cas_sc<'p>(
&self,
current: Ptr<'p, T>,
new: Ptr<'p, T>
) -> Result<(), Ptr<'p, T>>
[src]
&self,
current: Ptr<'p, T>,
new: Ptr<'p, T>
) -> Result<(), Ptr<'p, T>>
If the tagged atomic pointer is equal to current
, stores new
.
The return value is a result indicating whether the new pointer was stored. On failure the current value of the tagged atomic pointer is returned.
This operation uses the SeqCst
ordering.
pub fn cas_weak<'p>(
&self,
current: Ptr<'p, T>,
new: Ptr<'p, T>
) -> Result<(), Ptr<'p, T>>
[src]
&self,
current: Ptr<'p, T>,
new: Ptr<'p, T>
) -> Result<(), Ptr<'p, T>>
If the tagged atomic pointer is equal to current
, stores new
.
The return value is a result indicating whether the new pointer was stored. On failure the current value of the tagged atomic pointer is returned.
This method can sometimes spuriously fail even when comparison succeeds, which can result in more efficient code on some platforms.
This operation uses the AcqRel
ordering.
pub fn cas_weak_sc<'p>(
&self,
current: Ptr<'p, T>,
new: Ptr<'p, T>
) -> Result<(), Ptr<'p, T>>
[src]
&self,
current: Ptr<'p, T>,
new: Ptr<'p, T>
) -> Result<(), Ptr<'p, T>>
If the tagged atomic pointer is equal to current
, stores new
.
The return value is a result indicating whether the new pointer was stored. On failure the current value of the tagged atomic pointer is returned.
This method can sometimes spuriously fail even when comparison succeeds, which can result in more efficient code on some platforms.
This operation uses the SeqCst
ordering.
pub fn cas_box<'p>(
&self,
current: Ptr<'p, T>,
new: Box<T>,
tag: usize
) -> Result<Ptr<'p, T>, (Ptr<'p, T>, Box<T>)>
[src]
&self,
current: Ptr<'p, T>,
new: Box<T>,
tag: usize
) -> Result<Ptr<'p, T>, (Ptr<'p, T>, Box<T>)>
If the tagged atomic pointer is equal to current
, stores new
tagged with tag
.
The return value is a result indicating whether the new pointer was stored. On success the
new pointer is returned. On failure the current value of the tagged atomic pointer and
new
are returned.
This operation uses the AcqRel
ordering.
Panics
Panics if the tag doesn't fit into the unused bits of the pointer, or if the pointer is unaligned.
pub fn cas_box_sc<'p>(
&self,
current: Ptr<'p, T>,
new: Box<T>,
tag: usize
) -> Result<Ptr<'p, T>, (Ptr<'p, T>, Box<T>)>
[src]
&self,
current: Ptr<'p, T>,
new: Box<T>,
tag: usize
) -> Result<Ptr<'p, T>, (Ptr<'p, T>, Box<T>)>
If the tagged atomic pointer is equal to current
, stores new
tagged with tag
.
The return value is a result indicating whether the new pointer was stored. On success the
new pointer is returned. On failure the current value of the tagged atomic pointer and
new
are returned.
This operation uses the SeqCst
ordering.
Panics
Panics if the tag doesn't fit into the unused bits of the pointer, or if the pointer is unaligned.
pub fn cas_box_weak<'p>(
&self,
current: Ptr<'p, T>,
new: Box<T>,
tag: usize
) -> Result<Ptr<'p, T>, (Ptr<'p, T>, Box<T>)>
[src]
&self,
current: Ptr<'p, T>,
new: Box<T>,
tag: usize
) -> Result<Ptr<'p, T>, (Ptr<'p, T>, Box<T>)>
If the tagged atomic pointer is equal to current
, stores new
tagged with tag
.
The return value is a result indicating whether the new pointer was stored. On success the
new pointer is returned. On failure the current value of the tagged atomic pointer and
new
are returned.
This method can sometimes spuriously fail even when comparison succeeds, which can result in more efficient code on some platforms.
This operation uses the AcqRel
ordering.
Panics
Panics if the tag doesn't fit into the unused bits of the pointer, or if the pointer is unaligned.
pub fn cas_box_weak_sc<'p>(
&self,
current: Ptr<'p, T>,
new: Box<T>,
tag: usize
) -> Result<Ptr<'p, T>, (Ptr<'p, T>, Box<T>)>
[src]
&self,
current: Ptr<'p, T>,
new: Box<T>,
tag: usize
) -> Result<Ptr<'p, T>, (Ptr<'p, T>, Box<T>)>
If the tagged atomic pointer is equal to current
, stores new
tagged with tag
.
The return value is a result indicating whether the new pointer was stored. On success the
new pointer is returned. On failure the current value of the tagged atomic pointer and
new
are returned.
This method can sometimes spuriously fail even when comparison succeeds, which can result in more efficient code on some platforms.
This operation uses the AcqRel
ordering.
Panics
Panics if the tag doesn't fit into the unused bits of the pointer, or if the pointer is unaligned.
pub unsafe fn cas_raw(
&self,
current: (*mut T, usize),
new: (*mut T, usize),
order: Ordering
) -> Result<(), (*mut T, usize)>
[src]
&self,
current: (*mut T, usize),
new: (*mut T, usize),
order: Ordering
) -> Result<(), (*mut T, usize)>
If the tagged atomic pointer is equal to current
, stores new
.
The return value is a result indicating whether the new pointer was stored. On failure the current value of the tagged atomic pointer is returned.
Argument order
describes the memory ordering of this operation.
Panics
Panics if the tag doesn't fit into the unused bits of the pointer, or if the pointer is unaligned.
pub unsafe fn cas_raw_weak(
&self,
current: (*mut T, usize),
new: (*mut T, usize),
order: Ordering
) -> Result<(), (*mut T, usize)>
[src]
&self,
current: (*mut T, usize),
new: (*mut T, usize),
order: Ordering
) -> Result<(), (*mut T, usize)>
If the tagged atomic pointer is equal to current
, stores new
.
The return value is a result indicating whether the new pointer was stored. On failure the current value of the tagged atomic pointer is returned.
This method can sometimes spuriously fail even when comparison succeeds, which can result in more efficient code on some platforms.
Argument order
describes the memory ordering of this operation.
Panics
Panics if the tag doesn't fit into the unused bits of the pointer, or if the pointer is unaligned.
Trait Implementations
impl<T: Send + Sync> Send for Atomic<T>
[src]
impl<T: Send + Sync> Sync for Atomic<T>
[src]
impl<T> Default for Atomic<T>
[src]
impl<T: Debug> Debug for Atomic<T>
[src]
Auto Trait Implementations
impl<T> Unpin for Atomic<T>
impl<T> UnwindSafe for Atomic<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> RefUnwindSafe for Atomic<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,