mn_task.hpp
Go to the documentation of this file.
117 basic_task() noexcept : basic_task(" ", priority::Normal, MN_THREAD_CONFIG_MINIMAL_STACK_SIZE) { }
125 explicit basic_task(std::string strName, basic_task::priority uiPriority = basic_task::priority::Normal,
Definition: mn_binary_semaphore.hpp:29
Wrapper class around FreeRTOS's implementation of a event_group.
Definition: mn_eventgroup.hpp:35
static void nsleep(const timespan_t &req, timespan_t *rem)
pause execution for a specified time
Definition: mn_task.hpp:388
@ Urgent
@ Critical
@ Normal
@ HalfCritical
std::string get_name()
Get the debug name of this task.
Definition: mn_task.cpp:236
void set_priority(basic_task::priority uiPriority)
Set the priority of this task.
Definition: mn_task.cpp:328
unsigned short m_usStackDepth
Stack depth of this task, in words.
Definition: mn_task.hpp:439
@ Blocked
@ Running
@ Deleted
@ Suspended
@ Ready
static void sleep(unsigned int secs)
sleep this task for n seconds
Definition: mn_task.hpp:377
basic_task::priority m_uiPriority
A saved / cached copy of what the task's priority is.
Definition: mn_task.hpp:435
static bool is_current(basic_task *task)
Is the given task the current running task ?
Definition: mn_task.hpp:406
basic_task::priority get_priority()
Get the priority of this task.
Definition: mn_task.cpp:245
native_handle_type m_pHandle
Reference to the underlying task handle for this task.
Definition: mn_task.hpp:460
virtual void on_start()
This virtual function call on creating, use for user code It is optional whether you implement this o...
Definition: mn_task.hpp:293
virtual int start(int uiCore=MN_THREAD_CONFIG_DEFAULT_CORE)
Create and starts the Task.
Definition: mn_task.cpp:77
virtual void on_kill()
This virtual function call on kill, use for user code It is optional whether you implement this or no...
Definition: mn_task.hpp:298
int get_return_value()
Get the return value of this task - after run.
Definition: mn_task.cpp:291
int wait(unsigned int xTimeOut)
Wait for start the task.
Definition: mn_task.cpp:174
int32_t get_on_core()
Get the core number of this task run.
Definition: mn_task.cpp:228
static void usleep(unsigned int usec)
sleep this task for n micro seconds
Definition: mn_task.hpp:383
int m_retval
The return value from user task routine.
Definition: mn_task.hpp:443
static uint32_t get_tasks()
Get current number of tasks.
Definition: mn_task.cpp:276
bool m_bRunning
Flag whether or not the task was started.
Definition: mn_task.hpp:447
LockType_t m_runningMutex
Lock Objekt for task safty.
Definition: mn_task.hpp:426
int kill()
Destroy and delete the task and call the function 'on_kill'.
Definition: mn_task.cpp:189
virtual ~basic_task()
Our destructor. Delete the task.
Definition: mn_task.cpp:64
unsigned short get_stackdepth()
Get the stack depth of this task.
Definition: mn_task.cpp:260
static basic_task * get_self()
Get the current task.
Definition: mn_task.cpp:309
int32_t m_iCore
A saved / cached copy of which core this task is running on.
Definition: mn_task.hpp:455
xTaskHandle get_handle()
Accessor to get the task's backing task handle. There is no setter, on purpose.
Definition: mn_task.cpp:268
static void suspend(basic_task *t)
Suspend the given task.
Definition: mn_task.hpp:359
int32_t get_id()
Get the FreeRTOS task Numberid of this task.
Definition: mn_task.cpp:220
static void runtaskstub(void *parm)
Adapter function that allows you to write a class specific on_task() function that interfaces with Fr...
Definition: mn_task.cpp:353
static void resume(basic_task *t)
Resume the given task.
Definition: mn_task.hpp:366
virtual void on_cleanup()
Called on exit from your on_task() routine.
Definition: mn_task.hpp:314
virtual int on_task()
Implementation of your actual task code. You must override this function.
Definition: mn_task.hpp:306
int join(unsigned int xTickTimeout=portMAX_DELAY)
join the task, Wait in other task to end this task.
Definition: mn_task.cpp:157
timespan_t get_time_since_start() const
Get the time since start of this task.
Definition: mn_task.cpp:299
This class represents a time span (using microseconds)
Definition: mn_timespan.hpp:35
#define MN_THREAD_CONFIG_CORE_PRIORITY_CRITICAL
Task priority for basic_task::PriorityCritical.
Definition: mn_config.hpp:202
#define MN_THREAD_CONFIG_CORE_PRIORITY_HALFCRT
Task priority for basic_task::PriorityHalfCritical.
Definition: mn_config.hpp:188
#define MN_THREAD_CONFIG_CORE_PRIORITY_NORM
Task priority for basic_task::PriorityNormal.
Definition: mn_config.hpp:181
#define MN_THREAD_CONFIG_CORE_PRIORITY_IDLE
Task priority for basic_task::PriorityIdle.
Definition: mn_config.hpp:167
#define MN_THREAD_CONFIG_CORE_PRIORITY_LOW
Task priority for basic_task::PriorityLow.
Definition: mn_config.hpp:174
#define MN_THREAD_CONFIG_CORE_PRIORITY_URGENT
Task priority for basic_task::PriorityUrgent.
Definition: mn_config.hpp:195
#define MN_THREAD_CONFIG_MINIMAL_STACK_SIZE
Definition: mn_config.hpp:219
#define MN_THREAD_CONFIG_DEFAULT_CORE
Pre defined on which core must run the task, can override in the create function.
Definition: mn_config.hpp:98
A list of all error codes in this lib. This file is part of the Mini Thread Library (https://github....
Definition: mn_allocator_typetraits.hpp:25