INOS
|
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 void * | GetSuspendHook () |
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. | |
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.
apName | Name of task |
auStackSize | Requested stack size [bytes]. If one is not sure what number to take here, use defDefaultStackSize |
auPriority | Requested task priority. For more info see section Priority |
abFloatingPoint | True 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 |
auTimeSlice | Required 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 |
abInterruptsDisabled | True if all interrupts should be disabled during execution of the task. IMPORTANT: only set true here if you really know what you are doing! |
apHandler | Pointer to main task loop function or NULL if the task loop is within Action() |
apObject | This pointer of object with main task loop function or NULL if not used |
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.
aFunction | Task function |
apParam | Pointer to task param |
auPriority | Requested task priority. For more info see section Priority |
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.
apName | Name of task |
aFunction | Task function |
apParam | Pointer to task param |
auPriority | Requested task priority. For more info see section Priority |
Task action loop, needs to be overwritten by the user. For more info, see section Creation.
Reimplemented in CINOSSioTftExp, CINOS1ms, and CINOSTaskEx.
Check if a shutdown is pending.
Terminate myself.
auExitCode | Exit code |
Join task or in other words, wait till it terminates.
Set exit code.
auExitCode | Exit code |
Set Suspend hook.
apSuspendHook | Pointer to Suspend hook |
|
virtual |
Shutdown task, used to shutdown a foreign task.
apSync | Pointer to sync object if used asynchronous |
Reimplemented in CINOSTaskEx.