Struct hazard::Hazard
[−]
[src]
#[repr(C)]pub struct Hazard<T, M> where M: Memory { /* fields omitted */ }
A collection of pointers considered hazardous.
Methods
impl<T, M> Hazard<T, M> where M: Memory
[src]
fn new(memory: M, threads: usize, domains: usize, threshold: usize) -> Self
Constructs a new Hazard
.
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.
fn mark(&self, thread: usize, domain: usize, pointer: *mut T) -> *mut T
Sets the hazardous pointer for the supplied domain using the supplied thread.
fn clear(&self, thread: usize, domain: usize)
Clears the hazardous pointer for the supplied domain using the supplied thread.
fn hazardous(&self, pointer: *mut T) -> bool
Returns whether the supplied pointer is considered hazardous.
fn retire(&self, thread: usize, pointer: *mut T)
Retires the supplied pointer using the supplied thread.