On Time RTOS-32 Documentation
Welcome
RTTarget-32
RTKernel-32
RTKernel-32 Programming Manual
RTKernel-32 Reference Manual
Module RTKernel-32
RTKernel-32 Configuration
Function RTKernelInit
Task Management
Enquiring Tasks
Time
Semaphores
Mailboxes
Message Passing
Interrupt Handling
Memory Pools
Kernel Tracer
Spinlocks
Miscellaneous RTKernel-32 Operations
Function RTKDebugVersion
Function RTKInitialized
Function RTKStackCheck
Function RTKCanPreempt
Function RTKPreemptionsON
Function RTKPreemptionsOFF
Function RTKScheduler
Function RTKSetMessageHandler
Function RTKSetTaskSwitchHook
Function RTKSetTaskStartStopHook
Function RTKFatalError
Function RTKInstallExitTask
Function RTKExit
Function RTKAlloc
Function RTKDeallocTerminatedTasks
Function RTKWin32ToRTKHandle
Function RTKToWin32Handle
Port I/O Functions
Module FineTime
Module Clock
Module Timer
Module RTCom
Module RTKeybrd
Module RTTextIO
Module CPUMoni
Module RTProf
RTFiles-32
RTIP-32
RTPEG-32
RTUSB-32
|
Function RTKSetTaskStartStopHook
Function RTKSetTaskStartStopHook allows the installation of a function to be called on every task creation and termination:
typedef void (RTKAPI * RTKTaskStartStopHook)(RTKTaskHandle Task, int Reason);
void RTKSetTaskStartStopHook(RTKTaskStartStopHook Hook, RTKTaskStartStopHook * OldHook);
ParametersHookA function with the handle of the respective task and an integer as parameters.
OldHookShould point to a variable to receive a pointer to the previously installed hook.
The hook function's parameter Reason indicates whether the hook was called due to a task creation (Reason == 0) or termination (Reason == 1). The following rules should be observed in task start/stop hooks:
- At task creation, the hook is called after the system driver's hook.
- At task creation, the hook is guaranteed to be called in the context of the task being created. The hook is executed immediately before the task function code.
- At task termination, the hook is called before the system driver's hook.
- At task termination, the hook is not guaranteed to be called in the context of the terminating task; it could be called by another task which has called RTKTerminateTask.
- The hook is not called for the creation of the main task. However, the hook can be called for termination if the main task is terminated.
- The hook is not called at program exit.
- Before returning, the hook must call the previously installed hook.
Function RTKSetTaskSwitchHook
Function RTKFatalError
|