Classes |
Public Types |
Public Member Functions |
Protected Member Functions |
Private Attributes |
List of all members
mn::basic_thread Class Reference
#include <mn_thread.hpp>
Inheritance diagram for mn::basic_thread:
Collaboration diagram for mn::basic_thread:
Classes | |
class | id |
Public Types | |
using | base_type = basic_task |
using | native_handle_type = typename base_type::native_handle_type |
using | func_type = mn::function< int(void *)> |
Public Types inherited from mn::basic_task | |
enum class | priority { Idle = MN_THREAD_CONFIG_CORE_PRIORITY_IDLE , Low = MN_THREAD_CONFIG_CORE_PRIORITY_LOW , Normal = MN_THREAD_CONFIG_CORE_PRIORITY_NORM , HalfCritical = MN_THREAD_CONFIG_CORE_PRIORITY_HALFCRT , Urgent = MN_THREAD_CONFIG_CORE_PRIORITY_URGENT , Critical = MN_THREAD_CONFIG_CORE_PRIORITY_CRITICAL } |
Task priority. More... | |
enum class | state { Running = 0 , Ready , Blocked , Suspended , Deleted } |
using | native_handle_type = xTaskHandle |
Public Member Functions | |
basic_thread (std::string strName, func_type *func, basic_task::priority uiPriority=basic_task::priority::Normal, unsigned short usStackDepth=MN_THREAD_CONFIG_MINIMAL_STACK_SIZE) noexcept | |
basic_thread (const basic_thread &)=delete | |
basic_thread & | operator= (const basic_thread &)=delete |
Public Member Functions inherited from mn::basic_task | |
basic_task () noexcept | |
basic_task (std::string strName, basic_task::priority uiPriority=basic_task::priority::Normal, unsigned short usStackDepth=MN_THREAD_CONFIG_MINIMAL_STACK_SIZE) noexcept | |
virtual | ~basic_task () |
Our destructor. Delete the task. More... | |
virtual int | start (int uiCore=MN_THREAD_CONFIG_DEFAULT_CORE) |
Create and starts the Task. More... | |
int | kill () |
Destroy and delete the task and call the function 'on_kill'. More... | |
bool | is_running () |
Is the Task running? More... | |
std::string | get_name () |
Get the debug name of this task. More... | |
basic_task::priority | get_priority () |
Get the priority of this task. More... | |
unsigned short | get_stackdepth () |
Get the stack depth of this task. More... | |
xTaskHandle | get_handle () |
Accessor to get the task's backing task handle. There is no setter, on purpose. More... | |
int | get_return_value () |
Get the return value of this task - after run. More... | |
timespan_t | get_time_since_start () const |
Get the time since start of this task. More... | |
int32_t | get_id () |
Get the FreeRTOS task Numberid of this task. More... | |
int32_t | get_on_core () |
Get the core number of this task run. More... | |
void | set_priority (basic_task::priority uiPriority) |
Set the priority of this task. More... | |
void | suspend () |
Suspend this task. More... | |
void | resume () |
Resume a specific task. More... | |
bool | joinable () const noexcept |
int | join (unsigned int xTickTimeout=portMAX_DELAY) |
join the task, Wait in other task to end this task. More... | |
int | join (timespan_t time) |
join the task, Wait in other task to end this task. More... | |
int | wait (unsigned int xTimeOut) |
Wait for start the task. More... | |
int | wait (timespan_t time) |
Wait for start the task. More... | |
virtual void | on_start () |
This virtual function call on creating, use for user code It is optional whether you implement this or not. More... | |
virtual void | on_kill () |
This virtual function call on kill, use for user code It is optional whether you implement this or not. More... | |
virtual void | on_cleanup () |
Called on exit from your on_task() routine. More... | |
state | get_state () |
Get the state of the task. More... | |
operator xTaskHandle () | |
Operator to get the task's backing task handle. More... | |
operator int () | |
Operator to get the ID assigned to the task. More... | |
bool | operator== (const basic_task &r) const |
bool | operator!= (const basic_task &r) const |
bool | operator< (const basic_task &r) const |
bool | operator> (const basic_task &r) const |
Protected Member Functions | |
int | on_task () |
Implementation of your actual task code. You must override this function. More... | |
Private Attributes | |
func_type | m_funcTion |
Additional Inherited Members | |
Static Public Member Functions inherited from mn::basic_task | |
static void | suspend (basic_task *t) |
Suspend the given task. More... | |
static void | resume (basic_task *t) |
Resume the given task. More... | |
static void | yield () |
Yield the scheduler. More... | |
static void | sleep (unsigned int secs) |
sleep this task for n seconds More... | |
static void | usleep (unsigned int usec) |
sleep this task for n micro seconds More... | |
static void | nsleep (const timespan_t &req, timespan_t *rem) |
pause execution for a specified time More... | |
static uint32_t | get_tasks () |
Get current number of tasks. More... | |
static bool | is_current (basic_task *task) |
Is the given task the current running task ? More... | |
static basic_task * | get_self () |
Get the current task. More... | |
Static Protected Member Functions inherited from mn::basic_task | |
static void | runtaskstub (void *parm) |
Adapter function that allows you to write a class specific on_task() function that interfaces with FreeRTOS. More... | |
Protected Attributes inherited from mn::basic_task | |
LockType_t | m_runningMutex |
Lock Objekt for task safty. More... | |
LockType_t | m_contextMutext |
LockType_t | m_continuemutex |
std::string | m_strName |
The name of this task. More... | |
basic_task::priority | m_uiPriority |
A saved / cached copy of what the task's priority is. More... | |
unsigned short | m_usStackDepth |
Stack depth of this task, in words. More... | |
int | m_retval |
The return value from user task routine. More... | |
bool | m_bRunning |
Flag whether or not the task was started. More... | |
int32_t | m_iID |
The FreeRTOS task Number. More... | |
int32_t | m_iCore |
A saved / cached copy of which core this task is running on. More... | |
native_handle_type | m_pHandle |
Reference to the underlying task handle for this task. More... | |
event_group_t | m_eventGroup |
Class Documentation
◆ mn::basic_thread::id
class mn::basic_thread::id |
Member Typedef Documentation
◆ base_type
◆ func_type
using mn::basic_thread::func_type = mn::function<int(void*)> |
◆ native_handle_type
using mn::basic_thread::native_handle_type = typename base_type::native_handle_type |
Constructor & Destructor Documentation
◆ basic_thread() [1/2]
|
inlinenoexcept |
◆ basic_thread() [2/2]
|
delete |
Member Function Documentation
◆ on_task()
|
inlineprotectedvirtual |
Implementation of your actual task code. You must override this function.
- Returns
- Your return your task function, get with get_return_value()
Reimplemented from mn::basic_task.
◆ operator=()
|
delete |
Member Data Documentation
◆ m_funcTion
|
private |
The documentation for this class was generated from the following file: