Tenok
A Linux-like Real-Time Operating System for Robotics and Internet of Things
Data Structures | Macros | Typedefs | Functions
task.h File Reference
#include <stdint.h>
Include dependency graph for task.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  task_hook
 

Macros

#define HOOK_USER_TASK(_task_func, _priority, _stacksize)
 Register a user task to be launched at the start of the system. More...
 

Typedefs

typedef void(* task_func_t) (void)
 
typedef void(* thread_func_t) (void)
 

Functions

int task_create (task_func_t task_func, uint8_t priority, int stack_size)
 Create new task. More...
 

Macro Definition Documentation

◆ HOOK_USER_TASK

#define HOOK_USER_TASK (   _task_func,
  _priority,
  _stacksize 
)
Value:
static struct task_hook _##_task_func \
__attribute__((section(".tasks"), used)) = { \
.task_func = _task_func, \
.priority = _priority, \
.stacksize = _stacksize, \
}
Definition: task.h:12

Register a user task to be launched at the start of the system.

Parameters
task_funcThe task function to run.
priorityThe priority of the task.
stacksizeThe stack size of the task.
Return values
None

Function Documentation

◆ task_create()

int task_create ( task_func_t  task_func,
uint8_t  priority,
int  stack_size 
)

Create new task.

Parameters
task_funcThe task function to run.
priorityThe priority of the task.
stack_sizeThe stack size of the task.
Return values
intThe function returns positive task PID number on success; otherwise it returns a negative error number.