Struct Pointers

Source
#[repr(C)]
pub struct Pointers<T, M>
where M: Memory,
{ /* private fields */ }
Expand description

A collection of hazardous pointers.

Implementations§

Source§

impl<T, M> Pointers<T, M>
where M: Memory,

Source

pub fn new(memory: M, threads: usize, domains: usize, threshold: usize) -> Self

Constructs a new Pointers.

The maximum number of threads is specified by threads and the maximum number of hazardous pointers per thread is specified by domains.

The maximum size lists of retired pointers can grow to is specified by threshold. Once a list of retired pointers reaches this limit, any pointers that are no longer hazardous are removed from the list and the memory they refer to is deallocated.

Source

pub fn mark( &self, thread: usize, domain: usize, pointer: &AtomicPtr<T>, ) -> *mut T

Sets the hazardous pointer for the supplied domain using the supplied thread.

Forward progress guarantee: lock-free.

Source

pub fn mark_ptr(&self, thread: usize, domain: usize, pointer: *mut T) -> *mut T

Sets the hazardous pointer for the supplied domain using the supplied thread.

Forward progress guarantee: wait-free population oblivious.

Source

pub fn clear(&self, thread: usize, domain: usize)

Clears the hazardous pointer for the supplied domain using the supplied thread.

Forward progress guarantee: wait-free population oblivious.

Source

pub fn hazardous(&self, pointer: *mut T) -> bool

Returns whether the supplied pointer is considered hazardous.

Forward progress guarantee: wait-free bounded (threads * domains).

Source

pub fn retire(&self, thread: usize, pointer: *mut T)

Retires the supplied pointer using the supplied thread.

Forward progress guarantee: wait-free bounded (threads * threads).

Trait Implementations§

Source§

impl<T, M> Debug for Pointers<T, M>
where M: Memory,

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T, M> Drop for Pointers<T, M>
where M: Memory,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<T, M> Freeze for Pointers<T, M>
where M: Freeze,

§

impl<T, M> !RefUnwindSafe for Pointers<T, M>

§

impl<T, M> !Send for Pointers<T, M>

§

impl<T, M> !Sync for Pointers<T, M>

§

impl<T, M> Unpin for Pointers<T, M>
where M: Unpin,

§

impl<T, M> UnwindSafe for Pointers<T, M>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.