Advanced Topics
K
A
DAK
155
A Task Termination Procedure can be coded as a Large or Medium model C procedure as
illustrated in the following example. The procedure receives an integer reason code
indicating whether the task is being stopped, killed or deleted. The mnemonics for these
reason codes are provided in the AMX header file AMX831SD.H.
Upon entry to the Task Termination Procedure, the following conditions exist:
Interrupts are enabled.
All registers are free for use.
A reason code is provided as a parameter.
(see ajtktrm description in Chapter 16)
The task's stack in effect at the time of the termination request is in use.
The Task Termination Procedure must return to AMX. It must not call procedure ajend
to end task execution.
#include "amx831sd.h" /* AMX Definitions */
void cdecl termproc( /* Task Termination Procedure */
int reason) /* Termination reason */
{switch(reason) {
case AMCFE:
:
Stop task is occurring
:
break;
case AMCFK:
:
Kill task is occurring
:
break;
case AMCFD:
:
Delete task is occurring
:
break;
} /* end of switch */
}