type List<S> = ShardedList<Task<S>, <Task<S> as Link>::Target>;
Aliased Type§
struct List<S> {
lists: Box<[Mutex<LinkedList<Task<S>, Header>>]>,
added: MetricAtomicU64,
count: MetricAtomicUsize,
shard_mask: usize,
}
Fields§
§lists: Box<[Mutex<LinkedList<Task<S>, Header>>]>
§added: MetricAtomicU64
§count: MetricAtomicUsize
§shard_mask: usize
Implementations
Source§impl<L: ShardedListItem> ShardedList<L, L::Target>
impl<L: ShardedListItem> ShardedList<L, L::Target>
Sourcepub(crate) fn pop_back(&self, shard_id: usize) -> Option<L::Handle>
pub(crate) fn pop_back(&self, shard_id: usize) -> Option<L::Handle>
Removes the last element from a list specified by shard_id
and returns it, or None if it is
empty.
Sourcepub(crate) unsafe fn remove(
&self,
node: NonNull<L::Target>,
) -> Option<L::Handle>
pub(crate) unsafe fn remove( &self, node: NonNull<L::Target>, ) -> Option<L::Handle>
Removes the specified node from the list.
§Safety
The caller must ensure that exactly one of the following is true:
node
is currently contained byself
,node
is not contained by any list,node
is currently contained by some otherGuardedLinkedList
.
Sourcepub(crate) fn lock_shard(&self, val: &L::Handle) -> ShardGuard<'_, L, L::Target>
pub(crate) fn lock_shard(&self, val: &L::Handle) -> ShardGuard<'_, L, L::Target>
Gets the lock of ShardedList
, makes us have the write permission.
Sourcepub(crate) fn is_empty(&self) -> bool
pub(crate) fn is_empty(&self) -> bool
Returns whether the linked list does not contain any node.
Sourcepub(crate) fn shard_size(&self) -> usize
pub(crate) fn shard_size(&self) -> usize
Gets the shard size of this SharedList
.
Used to help us to decide the parameter shard_id
of the pop_back
method.