Skip to main content

PlatformTask

Struct PlatformTask 

Source
pub struct PlatformTask { /* private fields */ }
Expand description

A spawned platform task plus the storage the platform tracks it in.

alloc-gated, and it is the ONLY thing in this module that is: it owns a heap block sized from the platform’s own storage probes. The bare queries beside it (stack_unused_bytes) allocate nothing and stay available to a no-alloc image.

Joining is join rather than Drop, because both callers have to signal their worker to stop BEFORE waiting for it — a Drop that joined implicitly would deadlock against a worker still blocked on its own wait.

Implementations§

Source§

impl PlatformTask

Source

pub unsafe fn spawn( entry: unsafe extern "C" fn(*mut c_void) -> *mut c_void, arg: *mut c_void, stack_bytes: usize, name: *const i8, ) -> Option<PlatformTask>

Spawn entry(arg), or None when this platform cannot host a task (no storage sizing, allocation failure, or a refused spawn).

§Safety

arg must remain valid and pointed-to until join returns — the task dereferences it.

Source

pub unsafe fn spawn_with( entry: unsafe extern "C" fn(*mut c_void) -> *mut c_void, arg: *mut c_void, name: *const i8, stack_bytes: usize, priority: i64, ) -> Option<PlatformTask>

Spawn entry(arg) stating a PRIORITY as well.

phase-359 W10 — spawn inherits the creating task’s priority, which is right for the executor’s own workers and wrong for a TIER: a tier’s priority is the thing its author declared. priority <= 0 means “unstated” and inherits, matching how the board descriptors spell an absent priority; anything positive is the kernel’s own number and is passed through the band’s RAW escape hatch, because a [tiers.<name>.<rtos>] priority is already in the kernel’s units.

§Safety

Same as spawn.

Source

pub fn join(self)

Block until the task exits, then release its storage.

The caller must already have told the task to stop; this only waits.

Trait Implementations§

Source§

impl Drop for PlatformTask

Available on crate feature alloc only.
Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.