AMX 86 Frozen Dessert Maker User Manual


 
154
K
A
DAK
Advanced Topics
Kill a Task
A task can be killed. The task is first stopped as just described. All outstanding requests
to the task for its execution are purged. The effect is the same as if the task continued to
make calls to
ajend to end its operation until finally there were no task execution
requests remaining. A task can kill itself.
A task that has been killed does not cease to exist. Any new requests to trigger the task
or to send messages to it will be honored.
You must not kill any task which is waiting for a semaphore, an event group or a message
exchange.
Delete a Task
A task can be deleted. A task which is deleted ceases to exist. Its task id becomes
invalid and may be assigned by AMX to some other newly created task. A task can
delete itself.
You must not delete any task which is waiting for a semaphore, an event group or a
message exchange.
Task Termination Procedure
To safeguard against abuses of its task termination services, AMX inhibits any task from
being stopped, killed or deleted until the task itself indicates its willingness to be
abnormally terminated. A task does this by calling procedure
ajtktrm to inform AMX
that it is prepared to be abnormally terminated.
When a task calls ajtktrm to allow its abnormal termination, it gives AMX a pointer to a
Task Termination Procedure to be called by AMX whenever the task is stopped, killed or
deleted. A task can subsequently inhibit its own abnormal termination by calling
ajtktrm with a NULL procedure pointer.
Once a task enables abnormal termination, it remains enabled even if the task ends
normally. The next time the task executes, it will still be able to be abnormally
terminated. The previously defined Task Termination Procedure remains in effect until it
is cancelled by calling
ajtktrm to install a NULL pointer.
If a task is stopped or killed, AMX resets its Task Termination Procedure pointer to
NULL
thereby inhibiting any further requests to stop or kill the task until the task has had a
chance to execute again and specify a new Task Termination Procedure.