Asynchronous Serial Communications Programmer's Reference Manual (32022-90052)

114 Chapter5
Using Subsystem Break
Subsystem Break Intrinsics
Subsystem Break Example
The code samples shown in the following figures, illustrate how you
might provide subsystem break capabilities in a program. The figures
show two procedures, one to handle the subsystem break itself, and one
to set up and enable subsystem break.
The sample procedure in Figure 5-1 is a break handler routine. This is
the procedure to which XCONTRAP will pass control when the
subsystem break signal is sent from a user’s terminal. Control might be
passed at any point in the execution of the process.
In this example, when the break handler gets control from XCONTRAP,
it writes a message to the user’s terminal to verify that a subsystem
break has occurred. The handler then takes whatever action is coded as
the appropriate subsystem break response for the program. Finally, the
break handler calls RESETCONTROL, and checks for successful
completion before the procedure ends, (using the Pascal/iX
ccode
function). If the RESETCONTROL intrinsic does not complete
successfully, the procedure will notify the user that the attempt to
reenable subsystem break failed.
Note that the RESETCONTROL call does not have to be included in the
break handling procedure. You can call RESETCONTROL from any
place in the application (keeping in mind that it must execute before
another subsystem break is to be allowed). However, the break handler
is a convenient place to put the call if you want to make sure of its
timely execution.