Struct crossbeam_epoch::sync::list::List
source · pub(crate) struct List<T, C: IsElement<T> = T> {
head: Atomic<Entry>,
_marker: PhantomData<(T, C)>,
}
Expand description
A lock-free, intrusive linked list of type T
.
Fields§
§head: Atomic<Entry>
The head of the linked list.
_marker: PhantomData<(T, C)>
The phantom data for using T
and C
.
Implementations§
source§impl<T, C: IsElement<T>> List<T, C>
impl<T, C: IsElement<T>> List<T, C>
sourcepub(crate) unsafe fn insert<'g>(
&'g self,
container: Shared<'g, T>,
guard: &'g Guard,
)
pub(crate) unsafe fn insert<'g>( &'g self, container: Shared<'g, T>, guard: &'g Guard, )
Inserts entry
into the head of the list.
§Safety
You should guarantee that:
container
is not nullcontainer
is immovable, e.g. inside anOwned
- the same
Entry
is not inserted more than once - the inserted object will be removed before the list is dropped
sourcepub(crate) fn iter<'g>(&'g self, guard: &'g Guard) -> Iter<'g, T, C> ⓘ
pub(crate) fn iter<'g>(&'g self, guard: &'g Guard) -> Iter<'g, T, C> ⓘ
Returns an iterator over all objects.
§Caveat
Every object that is inserted at the moment this function is called and persists at least until the end of iteration will be returned. Since this iterator traverses a lock-free linked list that may be concurrently modified, some additional caveats apply:
- If a new object is inserted during iteration, it may or may not be returned.
- If an object is deleted during iteration, it may or may not be returned.
- The iteration may be aborted when it lost in a race condition. In this case, the winning thread will continue to iterate over the same list.
Trait Implementations§
Auto Trait Implementations§
impl<T, C = T> !Freeze for List<T, C>
impl<T, C> RefUnwindSafe for List<T, C>where
T: RefUnwindSafe,
C: RefUnwindSafe,
impl<T, C> Send for List<T, C>
impl<T, C> Sync for List<T, C>
impl<T, C> Unpin for List<T, C>
impl<T, C> UnwindSafe for List<T, C>where
T: UnwindSafe,
C: UnwindSafe,
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