INOS
CINOSTask Class Reference
Inheritance diagram for CINOSTask:

Public Types

enum  ETskType {
  eTskTypeBoot = 0 , eTskTypeResource = 1 , eTskTypeSystem = 2 , eTskTypeApplication = 3 ,
  eTskTypeCommunication = 4 , eTskTypeRealtime = 5 , eTskTypeInterrupt = 6 , eTskTypeBackground = 7 ,
  eTskTypeLua = 8 , eTskTypeTest = 9 , eTskTypeReserved0 = 10 , eTskTypeReserved1 = 11 ,
  eTskTypeUser0 = 12 , eTskTypeUser1 = 13 , eTskTypeUser2 = 14 , eTskTypeUser3 = 15
}
 Task types.
 

Public Member Functions

 CINOSTask (char *apName=nullptr, uint32 auStackSize=defDefaultStackSize, uint32 auPriority=DF_INOS_TASK_PRIO_LOWEST, bool abFloatingPoint=true, uint32 auTimeSlice=defDefaultTimeSlice, bool abInterruptsDisabled=false, void *apHandler=0, void *apObject=0)
 Create a task with given properties. One needs to Resume the task after creation to get it running.
 
 CINOSTask (std::function< void(void *)> aFunction, void *apParam=nullptr, uint8 auPriority=DF_INOS_TASK_PRIO_LOWEST)
 Create a task with given properties. One needs to Resume the task after creation to get it running.
 
 CINOSTask (const char *apName, std::function< void(void *)> aFunction, void *apParam=nullptr, uint8 auPriority=DF_INOS_TASK_PRIO_LOWEST)
 Create a task with given properties. One needs to Resume the task after creation to get it running.
 
virtual ~CINOSTask ()
 Destroy task.
 
virtual uint32 Shutdown (CINOSSync *apSync=DF_INOS_SYNCHRONOUS)
 Shutdown task, used to shutdown a foreign task.
 
virtual uint32 Join ()
 Join task or in other words, wait till it terminates.
 
virtual void Detach ()
 Detach task from parent. One uses this method if one doesn't want this task to be shut down if the parent shuts down.
 
virtual void Exit ()
 Terminate myself. Exit code is INOS_OK or the code previously set with SetExitCode.
 
virtual void Exit (uint32 auExitCode)
 Terminate myself.
 
virtual void SetExitCode (uint32 auExitCode)
 Set exit code.
 
virtual uint32 GetExitCode ()
 Get exit code.
 
virtual bool CheckShutdown ()
 Check if a shutdown is pending.
 
virtual void SetSuspendHook (void *apSuspendHook)
 Set Suspend hook.
 
virtual void ClrSuspendHook ()
 Clear Suspend hook.
 
virtual voidGetSuspendHook ()
 Get Suspend hook if any.
 
INOS_INLINE ETskType GetTskType ()
 Get task type.
 
INOS_INLINE ETskType SetTskType (ETskType aeType)
 Set task type.
 

Protected Member Functions

virtual void Action ()
 Task action loop, needs to be overwritten by the user. For more info, see section Creation.
 

Constructor & Destructor Documentation

◆ CINOSTask() [1/3]

CINOSTask::CINOSTask ( char apName = nullptr,
uint32  auStackSize = defDefaultStackSize,
uint32  auPriority = DF_INOS_TASK_PRIO_LOWEST,
bool  abFloatingPoint = true,
uint32  auTimeSlice = defDefaultTimeSlice,
bool  abInterruptsDisabled = false,
void apHandler = 0,
void apObject = 0 
)

Create a task with given properties. One needs to Resume the task after creation to get it running.

Parameters
apNameName of task
auStackSizeRequested stack size [bytes]. If one is not sure what number to take here, use defDefaultStackSize
auPriorityRequested task priority. For more info see section Priority
abFloatingPointTrue if task requires floating point support. If one is sure that the task doesn't use floating point instruction, one can provide false here, this lowers task switching time due to the fact, that floating point registers do not need to be saved and restored
auTimeSliceRequired time slice [us] or defDefaultNoTimeSlice (0xffffffff) if time slicing needs to be avaoided for this task. Time slicing doesn't make sense for e.g. high prior cyclic task like fieldbus handlers. For more info see section Timeslice
abInterruptsDisabledTrue if all interrupts should be disabled during execution of the task. IMPORTANT: only set true here if you really know what you are doing!
apHandlerPointer to main task loop function or NULL if the task loop is within Action()
apObjectThis pointer of object with main task loop function or NULL if not used

◆ CINOSTask() [2/3]

CINOSTask::CINOSTask ( std::function< void(void *)>  aFunction,
void apParam = nullptr,
uint8  auPriority = DF_INOS_TASK_PRIO_LOWEST 
)

Create a task with given properties. One needs to Resume the task after creation to get it running.

Parameters
aFunctionTask function
apParamPointer to task param
auPriorityRequested task priority. For more info see section Priority

◆ CINOSTask() [3/3]

CINOSTask::CINOSTask ( const char apName,
std::function< void(void *)>  aFunction,
void apParam = nullptr,
uint8  auPriority = DF_INOS_TASK_PRIO_LOWEST 
)

Create a task with given properties. One needs to Resume the task after creation to get it running.

Parameters
apNameName of task
aFunctionTask function
apParamPointer to task param
auPriorityRequested task priority. For more info see section Priority

Member Function Documentation

◆ Action()

virtual void CINOSTask::Action ( )
protectedvirtual

Task action loop, needs to be overwritten by the user. For more info, see section Creation.

Reimplemented in CINOSSioTftExp, CINOS1ms, and CINOSTaskEx.

◆ CheckShutdown()

virtual bool CINOSTask::CheckShutdown ( )
inlinevirtual

Check if a shutdown is pending.

Returns
Return true if shutdown pending

◆ Exit()

virtual void CINOSTask::Exit ( uint32  auExitCode)
virtual

Terminate myself.

Parameters
auExitCodeExit code

◆ Join()

virtual uint32 CINOSTask::Join ( )
virtual

Join task or in other words, wait till it terminates.

Returns
Returns the task exit code (if called synchronous)

◆ SetExitCode()

virtual void CINOSTask::SetExitCode ( uint32  auExitCode)
inlinevirtual

Set exit code.

Parameters
auExitCodeExit code

◆ SetSuspendHook()

virtual void CINOSTask::SetSuspendHook ( void apSuspendHook)
inlinevirtual

Set Suspend hook.

Parameters
apSuspendHookPointer to Suspend hook

◆ Shutdown()

virtual uint32 CINOSTask::Shutdown ( CINOSSync apSync = DF_INOS_SYNCHRONOUS)
virtual

Shutdown task, used to shutdown a foreign task.

Parameters
apSyncPointer to sync object if used asynchronous
Returns
Returns the task exit code (if called synchronous)

Reimplemented in CINOSTaskEx.


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