19.5 Preventing Interference

This section describes how an active TSR can avoid interfering with the process it interrupts. Interference occurs when a TSR commits an error or performs an action that affects the interrupted process after the TSR returns. Examples of interference range from the relatively harmless, such as moving the cursor, to the serious, such as overrunning a stack.

Although a TSR can potentially interfere with another process in many different ways, protection against interference involves only three steps:

1.Recording a current configuration

2.Changing the configuration so it applies to the TSR

3.Restoring the original configuration before terminating

The example program in Section 19.8 demonstrates all the noninterference safeguards described in this section. These safeguards by no means exhaust the subject of noninterference. More sophisticated TSRs may require more sophisticated methods. However, noninterference methods generally fall into one of the following categories:

Trapping errors

Preserving an existing condition

Preserving existing data