Skip to main content

Task

Struct Task 

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

A handle to an OSAL task.

This is a wrapper around an osal_id_t that will automatically call OS_TaskDelete when it goes out of scope, preventing resource leaks.

Implementations§

Source§

impl Task

Source

pub fn new( name: &str, entry_point: unsafe extern "C" fn(), stack_size: usize, priority: u8, flags: TaskFlags, ) -> Result<Self>

Creates a new OSAL task and starts it running.

The stack for the task is allocated from the system memory heap.

§Arguments
  • name: A unique string to identify the task.
  • entry_point: The function that the new task will execute. This must be a free function with extern "C" linkage.
  • stack_size: The size of the stack to allocate for the new task. A value of 0 is non-portable: some RTOS use a default, others create a task with no stack. Always specify an actual size.
  • priority: The priority of the new task (0=highest, 255=lowest).
  • flags: Task creation flags (e.g. TaskFlags::FP_ENABLED).
Source

pub fn id(&self) -> TaskId

Returns the underlying TaskId for this task.

Source

pub fn get_info(&self) -> Result<TaskProp>

Retrieves information about this task.

Trait Implementations§

Source§

impl Debug for Task

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for Task

Source§

fn drop(&mut self)

Deletes the OSAL task when the Task object goes out of scope.

Auto Trait Implementations§

§

impl Freeze for Task

§

impl RefUnwindSafe for Task

§

impl Send for Task

§

impl Sync for Task

§

impl Unpin for Task

§

impl UnsafeUnpin for Task

§

impl UnwindSafe for Task

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.