1 use std::{ptr::NonNull, task::Poll};
6 vtable: &'static Vtable,
10 poll: unsafe fn(TaskRef) -> Poll<()>,
11 deallocate: unsafe fn(NonNull<Header>),
14 // in the "Header" type, which is a private type in maitake
16 pub(crate) const fn new_stub() -> Self {
17 unsafe fn nop(_ptr: TaskRef) -> Poll<()> {
21 unsafe fn nop_deallocate(ptr: NonNull<Header>) {
22 unreachable!("stub task ({ptr:p}) should never be deallocated!");
25 Self { vtable: &Vtable { poll: nop, deallocate: nop_deallocate } }
29 // This is a public type in `maitake`
31 #[cfg_attr(loom, allow(dead_code))]
37 /// Create a new unique stub [`Task`].
38 pub const fn new() -> Self {
39 Self { hdr: Header::new_stub() }