Function pros_sys::rtos::task_create

source ·
pub unsafe extern "C" fn task_create(
    function: task_fn_t,
    parameters: *const c_void,
    prio: u32,
    stack_depth: u16,
    name: *const c_char
) -> task_t
Expand description

Creates a new task and add it to the list of tasks that are ready to run.

This function uses the following values of errno when an error state is reached: ENOMEM - The stack cannot be used as the TCB was not created.

\param function Pointer to the task entry function \param parameters Pointer to memory that will be used as a parameter for the task being created. This memory should not typically come from stack, but rather from dynamically (i.e., malloc’d) or statically allocated memory. \param prio The priority at which the task should run. TASK_PRIO_DEFAULT plus/minus 1 or 2 is typically used. \param stack_depth The number of words (i.e. 4 * stack_depth) available on the task’s stack. TASK_STACK_DEPTH_DEFAULT is typically sufficienct. \param name A descriptive name for the task. This is mainly used to facilitate debugging. The name may be up to 32 characters long.

\return A handle by which the newly created task can be referenced. If an error occurred, NULL will be returned and errno can be checked for hints as to why task_create failed.