Important: The information in this document is obsolete and should not be used for new development.
Task Guidelines
This section summarizes the guidelines to follow if your application installs tasks that are executed at interrupt time.
- Make your interrupt task as short as possible. A good strategy is to have the interrupt task modify a global variable from which your application can determine what noninterrupt processing to perform. If this strategy is not sufficient, you can use the Deferred Task Manager to defer lengthy interrupt tasks until all interrupts are reenabled.
- If you modify your application's global variables from within an interrupt task or call routines in another code segment, make sure to set up and restore the A5 register. The chapters "Time Manager" and "Vertical Retrace Manager" in this book contain examples of this technique.
- Don't call any routines that cause memory to be moved or compacted, either directly or indirectly.
- Don't use any handles that are not locked.
- Make sure that the code segment containing the interrupt task is loaded, locked, and unpurgeable. Never unload a code segment containing an active interrupt task.
- Do not allocate parameter blocks or task records as local variables of routines that might return before the interrupt task is completed.
- Do not make synchronous calls in an interrupt task.
- Minimize the amount of stack space your task uses. Remember that some interrupt tasks execute at times when your application is not the current application; as a result, you might not be able to predict how much stack space is available to your task.
- Preserve all microprocessor registers other than A0-A3 and D0-D3. Most compilers for high-level languages automatically generate code that does this.