#include <mn_workqueue_task.hpp>

+ Inheritance diagram for mn::queue::work_queue_task:
+ Collaboration diagram for mn::queue::work_queue_task:

Public Member Functions

 work_queue_task (char const *strName, basic_task::priority uiPriority, unsigned short usStackDepth, basic_work_queue *parent)
 
virtual ~work_queue_task ()
 
- 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

virtual int on_task () override
 

Private Attributes

basic_work_queuem_parentWorkQueue
 

Additional Inherited Members

- 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
 
- 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_taskget_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
 

Detailed Description

The basic worker task for single task and multi task workqueue engines

Constructor & Destructor Documentation

◆ work_queue_task()

mn::queue::work_queue_task::work_queue_task ( char const *  strName,
basic_task::priority  uiPriority,
unsigned short  usStackDepth,
basic_work_queue parent 
)

Constructor for this workqueue task.

Parameters
strNameName of the task. Only useful for debugging.
uiPriorityFreeRTOS priority of this Task.
usStackDepthNumber of "words" allocated for the Task stack.
parentThe base work_queue for this worker Task

◆ ~work_queue_task()

mn::queue::work_queue_task::~work_queue_task ( )
virtual

Member Function Documentation

◆ on_task()

int mn::queue::work_queue_task::on_task ( )
overrideprotectedvirtual

Implementation of your actual work queue working code ( Omg ...)

Returns
The pointer of m_uiNumWorks -
See also
get_num_works()

Reimplemented from mn::basic_task.

Member Data Documentation

◆ m_parentWorkQueue

basic_work_queue* mn::queue::work_queue_task::m_parentWorkQueue
private

Holder of the base work_queue for this worker thread


The documentation for this class was generated from the following files: