#[repr(C)]pub(crate) struct Header {
pub(super) state: State,
pub(super) queue_next: UnsafeCell<Option<NonNull<Header>>>,
pub(super) vtable: &'static Vtable,
pub(super) owner_id: UnsafeCell<Option<NonZeroU64>>,
}
Expand description
Crate public as this is also needed by the pool.
Fields§
§state: State
Task state.
queue_next: UnsafeCell<Option<NonNull<Header>>>
Pointer to next task, used with the injection queue.
vtable: &'static Vtable
Table of function pointers for executing actions on the task.
owner_id: UnsafeCell<Option<NonZeroU64>>
This integer contains the id of the OwnedTasks
or LocalOwnedTasks
that this task is stored in. If the task is not in any list, should be
the id of the list that it was previously in, or None
if it has never
been in any list.
Once a task has been bound to a list, it can never be bound to another list, even if removed from the first list.
The id is not unset when removed from a list because we want to be able to read the id without synchronization, even if it is concurrently being removed from the list.
Implementations§
source§impl Header
impl Header
pub(super) unsafe fn set_next(&self, next: Option<NonNull<Header>>)
pub(super) unsafe fn set_owner_id(&self, owner: NonZeroU64)
pub(super) fn get_owner_id(&self) -> Option<NonZeroU64>
sourcepub(super) unsafe fn get_trailer(me: NonNull<Header>) -> NonNull<Trailer>
pub(super) unsafe fn get_trailer(me: NonNull<Header>) -> NonNull<Trailer>
Gets a pointer to the Trailer
of the task containing this Header
.
§Safety
The provided raw pointer must point at the header of a task.
sourcepub(super) unsafe fn get_scheduler<S>(me: NonNull<Header>) -> NonNull<S>
pub(super) unsafe fn get_scheduler<S>(me: NonNull<Header>) -> NonNull<S>
Gets a pointer to the scheduler of the task containing this Header
.
§Safety
The provided raw pointer must point at the header of a task.
The generic type S must be set to the correct scheduler type for this task.