Struct tokio::util::idle_notified_set::ListEntry
source · struct ListEntry<T> {
pointers: Pointers<ListEntry<T>>,
parent: Arc<Mutex<ListsInner<T>>>,
value: UnsafeCell<ManuallyDrop<T>>,
my_list: UnsafeCell<List>,
_pin: PhantomPinned,
}
Expand description
An entry in the list.
§Safety
The my_list
field must only be accessed while holding the mutex in
parent
. It is an invariant that the value of my_list
corresponds to
which linked list in the parent
holds this entry. Once this field takes
the value Neither
, then it may never be modified again.
If the value of my_list
is Notified
or Idle
, then the pointers
field
must only be accessed while holding the mutex. If the value of my_list
is
Neither
, then the pointers
field may be accessed by the
IdleNotifiedSet
(this happens inside drain
).
The value
field is owned by the IdleNotifiedSet
and may only be accessed
by the IdleNotifiedSet
. The operation that sets the value of my_list
to
Neither
assumes ownership of the value
, and it must either drop it or
move it out from this entry to prevent it from getting leaked. (Since the
two linked lists are emptied in the destructor of IdleNotifiedSet
, the
value should not be leaked.)
Fields§
§pointers: Pointers<ListEntry<T>>
The linked list pointers of the list this entry is in.
parent: Arc<Mutex<ListsInner<T>>>
Pointer to the shared Lists
struct.
value: UnsafeCell<ManuallyDrop<T>>
The value stored in this entry.
my_list: UnsafeCell<List>
Used to remember which list this entry is in.
_pin: PhantomPinned
Required by the linked_list::Pointers
field.
Implementations§
Trait Implementations§
source§impl<T> Link for ListEntry<T>
impl<T> Link for ListEntry<T>
§Safety
ListEntry
is forced to be !Unpin.