pub struct RcuIntrusiveList<T, A: RcuListAdapter<T>> { /* private fields */ }Implementations§
Source§impl<T, A: RcuListAdapter<T>> RcuIntrusiveList<T, A>
impl<T, A: RcuListAdapter<T>> RcuIntrusiveList<T, A>
Sourcepub fn is_empty(&self, scope: &RcuReadScope) -> bool
pub fn is_empty(&self, scope: &RcuReadScope) -> bool
Returns whether the list is currently empty without dereferencing any node links.
Sourcepub unsafe fn push_front<'a>(
&self,
scope: &'a RcuReadScope,
data: RcuPtrRef<'a, T>,
)
pub unsafe fn push_front<'a>( &self, scope: &'a RcuReadScope, data: RcuPtrRef<'a, T>, )
Pushes a new element to the front of the list.
Properly initializes link.prev to null and link.next to the former head (or null
if the list was empty) before publishing the node to head. This ensures that nodes
previously removed from other lists do not retain poisoned or stale pointers.
Note: Re-inserting a previously removed node overwrites its link.next pointer. List
iteration and re-insertion must be synchronized (e.g., via an external lock or by waiting
for an RCU grace period after removal); otherwise a concurrent iterator still visiting the
node may observe wrong results (such as skipping/repeating elements or continuing into the
destination list).
§Safety
- Requires external synchronization to exclude concurrent writers.
datamust be non-null, properly aligned, and point to a valid, initializedTthat outlives its membership in the list and any subsequent RCU reader grace period.datamust not currently be attached to any list.
Sourcepub unsafe fn push_back<'a>(
&self,
scope: &'a RcuReadScope,
data: RcuPtrRef<'a, T>,
)
pub unsafe fn push_back<'a>( &self, scope: &'a RcuReadScope, data: RcuPtrRef<'a, T>, )
Pushes a new element to the back of the list.
Properly initializes link.next to null and link.prev to the former tail (or null
if the list was empty) before publishing the node. This ensures that nodes
previously removed from other lists do not retain poisoned or stale pointers.
Note: Re-inserting a previously removed node overwrites its link.next pointer. List
iteration and re-insertion must be synchronized (e.g., via an external lock or by waiting
for an RCU grace period after removal); otherwise a concurrent iterator still visiting the
node may observe wrong results (such as skipping/repeating elements or continuing into the
destination list).
§Safety
- Requires external synchronization to exclude concurrent writers.
datamust be non-null, properly aligned, and point to a valid, initializedTthat outlives its membership in the list and any subsequent RCU reader grace period.datamust not currently be attached to any list.
Sourcepub unsafe fn append(&self, scope: &RcuReadScope, other: Self)
pub unsafe fn append(&self, scope: &RcuReadScope, other: Self)
Appends another list to the end of this list.
§Safety
Requires external synchronization to exclude concurrent writers.
Sourcepub unsafe fn remove<'a>(
&self,
scope: &'a RcuReadScope,
node: RcuPtrRef<'a, T>,
) -> RcuPtrRef<'a, Link>
pub unsafe fn remove<'a>( &self, scope: &'a RcuReadScope, node: RcuPtrRef<'a, T>, ) -> RcuPtrRef<'a, Link>
Removes the given node from the list.
Returns the link of the next node in the list, if any.
Concurrent readers may continue to see this entry in the list until the RCU state machine
has made sufficient progress to ensure that no concurrent readers are holding read guards.
If the removed node is re-inserted into a list, list iteration and re-insertion must be
synchronized; otherwise concurrent iterators still visiting node may observe wrong
results.
§Safety
- Requires external synchronization to exclude concurrent writers.
nodemust be non-null, properly aligned, and point to a valid, initializedTcurrently attached toself.- The removed
nodemust not be dropped while concurrent RCU readers may still be visiting it (e.g., wait for an RCU grace period before dropping).
Sourcepub unsafe fn split_off(&self, scope: &RcuReadScope, pos: usize) -> Self
pub unsafe fn split_off(&self, scope: &RcuReadScope, pos: usize) -> Self
Splits the list into two lists at the given position.
If the given position is past the end of the list, returns an empty list.
§Safety
Requires external synchronization to exclude concurrent writers.
Sourcepub unsafe fn update(&self, scope: &RcuReadScope, other: Self)
pub unsafe fn update(&self, scope: &RcuReadScope, other: Self)
Updates the list with the contents of another list.
Any elements previously in self are replaced in place without poisoning their Link::prev
pointers; call clear first if those elements need to be re-attached to a list later.
§Safety
Requires external synchronization to exclude concurrent writers.
Sourcepub unsafe fn clear<'a>(
&self,
scope: &'a RcuReadScope,
callback: impl Fn(RcuPtrRef<'a, T>),
)where
T: 'static,
pub unsafe fn clear<'a>(
&self,
scope: &'a RcuReadScope,
callback: impl Fn(RcuPtrRef<'a, T>),
)where
T: 'static,
Removes all elements from the list.
The callback is called for each element in the list. The caller is responsible for cleaning up the removed elements.
Concurrent readers may continue to see the old value of the list until the RCU state machine has made sufficient progress to ensure that no concurrent readers are holding read guards. If removed elements are re-inserted into a list, list iteration and re-insertion must be synchronized; otherwise concurrent iterators still visiting those elements may observe wrong results.
§Safety
- Requires external synchronization to exclude concurrent writers.
- Removed elements must not be dropped while concurrent RCU readers may still be visiting them (e.g., wait for an RCU grace period before dropping).
Sourcepub fn cursor<'a>(
&'a self,
scope: &'a RcuReadScope,
) -> RcuIntrusiveListCursor<'a, T, A>
pub fn cursor<'a>( &'a self, scope: &'a RcuReadScope, ) -> RcuIntrusiveListCursor<'a, T, A>
Returns a cursor that can be used to traverse and modify the list.
Concurrent readers may continue to see the old value of the list until the RCU state machine has made sufficient progress to ensure that no concurrent readers are holding read guards.
Sourcepub fn iter<'a>(&self, scope: &'a RcuReadScope) -> impl Iterator<Item = &'a T>where
T: 'static,
pub fn iter<'a>(&self, scope: &'a RcuReadScope) -> impl Iterator<Item = &'a T>where
T: 'static,
Returns an iterator over the elements in the list.