#include <mn_tasklet.hpp>

+ Collaboration diagram for mn::basic_tasklet:

Public Member Functions

 basic_tasklet ()
 
virtual int schedule (uint32_t parameter, unsigned int timeout=MN_THREAD_CONFIG_TIMEOUT_COROUTINE_DEFAULT)
 
virtual int destroy ()
 

Protected Member Functions

virtual bool on_tasklet (uint32_t arg)=0
 

Static Protected Member Functions

static void runtasklet (void *parm, uint32_t parameter)
 

Protected Attributes

counting_semaphore_t m_ssLock
 

Detailed Description

A FreeRTOS wrapper for its concept of a Pended Function. In Linux, one permutation of this would be a Tasklet, or bottom half processing from an ISR.

This is an abstract base class. To use this, you need to subclass it. All of your tasklet should be derived from the basic_tasklet class. Then implement the virtual on_tasklet function.

Constructor & Destructor Documentation

◆ basic_tasklet()

mn::basic_tasklet::basic_tasklet ( )

Member Function Documentation

◆ destroy()

int mn::basic_tasklet::destroy ( )
virtual

Destroy the Tasklet

Returns
ERR_COROUTINE_OK Destroyed without any errors

◆ on_tasklet()

virtual bool mn::basic_tasklet::on_tasklet ( uint32_t  arg)
protectedpure virtual

Implementation of your actual tasklet code. You must override this function.

Parameters
parameterValue passed to you from the create() methods.
Returns
false to end the on_tasklet and true when run

◆ runtasklet()

void mn::basic_tasklet::runtasklet ( void *  parm,
uint32_t  parameter 
)
staticprotected

Adapter function that allows you to write a class specific on_tasklet() function that interfaces with FreeRTOS.

◆ schedule()

int mn::basic_tasklet::schedule ( uint32_t  parameter,
unsigned int  timeout = MN_THREAD_CONFIG_TIMEOUT_COROUTINE_DEFAULT 
)
virtual

schedule this Tasklet to run.

Parameters
parameterValue passed to your on_tasklet method.
CmdTimeoutHow long to wait to send this command to the timer daemon.
Returns
ERR_COROUTINE_OK This command will be sent to the timer daemon, ERR_COROUTINE_CANSHEDULE It will not (i.e. timeout) and ERR_COROUTINE_CANTINITLOCKT The Locking Object can't create - tasklet not run

Member Data Documentation

◆ m_ssLock

counting_semaphore_t mn::basic_tasklet::m_ssLock
protected

Protect against accidental deletion before we were executed.


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