riot_sys::bindgen

Function thread_create

Source
pub unsafe extern "C" fn thread_create(
    stack: *mut c_char,
    stacksize: c_int,
    priority: u8,
    flags: c_int,
    task_func: thread_task_func_t,
    arg: *mut c_void,
    name: *const c_char,
) -> kernel_pid_t
Expand description

@brief Creates a new thread.

For an in-depth discussion of thread priorities, behavior and and flags, see @ref core_thread.

@note Avoid assigning the same priority to two or more threads. @note Creating threads from within an ISR is currently supported, however it is considered to be a bad programming practice and we strongly discourage you from doing so.

@param[out] stack start address of the preallocated stack memory @param[in] stacksize the size of the thread’s stack in bytes @param[in] priority priority of the new thread, lower mean higher priority @param[in] flags optional flags for the creation of the new thread @param[in] task_func pointer to the code that is executed in the new thread @param[in] arg the argument to the function @param[in] name a human readable descriptor for the thread

@return PID of newly created task on success @return -EINVAL, if @p priority is greater than or equal to @ref SCHED_PRIO_LEVELS @return -EOVERFLOW, if there are too many threads running already