Handling Signal Exceptions

To handle signal exceptions, a process must first call DosSetExceptionHandler to register a handler for the exceptions. Next, the process must call DosSetSignalExceptionFocus, with the Flag parameter set to ON, in order to receive signal exceptions.

After a process calls DosSetSignalExceptionFocus, it remains the signal focus for its screen group until it calls DosSetSignalExceptionFocus again with the Flag parameter set to OFF, or until another process in the screen group makes a call to the same function with Flag set to ON.

Each call to DosSetSignalExceptionFocus with Flag set to ON increments a counter in the per-task data area of the process. Each call with Flag set to OFF decrements the counter. When a signal exception occurs, the system checks to see whether the value of the counter is greater than 0. If it is, the signal is sent.

DosSetSignalExceptionFocus returns ERROR_NESTED_TOO_DEEP if the value of the counter exceeds 65535. If a thread tries to turn off the signal focus when the value of the counter is 0, ERROR_ALREADY_RESET is returned.

All 32-bit exception handlers that are attached to thread 1 of the process will be given an opportunity to handle the signal. If no 32-bit exception handler returns XCPT_CONTINUE_EXECUTION in response to the signal, and if a 16-bit exception handler is registered, then the 16-bit handler for the signal will be executed. If none exists, then the process will be terminated.

In order to continue receiving signals, the process must either return XCPT_CONTINUE_EXECUTION from a 32-bit exception handler, or it must call the 16-bit DosSetSigHandler function, specifying SIG_ACKNOWLEDGE as the value of the Action parameter to acknowledge the signal, or it must call DosAcknowledgeSignalException.

The typematic facility of the keyboard could cause a Ctrl+C or Ctrl+Break signal exception to repeat. For this reason, the system holds these exceptions until an exception handler returns XCPT_CONTINUE_EXECUTION, or calls DosAcknowledgeSignalException. However, only one signal exception is actually held; they are not queued by the system.

See Must-Complete Sections for information about how a process can defer the handling of signal exceptions.


[Back: Signal Exceptions]
[Next: Sending Signal Exceptions]