C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Transferring Interrupt Control
                                             Up Contents Index Back
─────C/C++ Language─────────────────────────────────────────────────────────
 
     An interrupt handler can transfer control to a second interrupt
     routine in either of two ways:
 
        ■ Call the interrupt routine (after casting it to an interrupt
          handler if necessary) if you need to do further processing
          after the second interrupt routine finishes. For example:
 
              void __interrupt __far new_int()
              {
                  // Initial processing here
                  ∙ ∙ ∙
                  (*old_int)();
                  ∙ ∙ ∙
                  // Final processing here
              }
 
        ■ Call _chain_intr with the interrupt routine as an argument.
          Do this if your routine is finished and you want the second
          interrupt routine to terminate the interrupt call. For
          example:
 
              void __interrupt __far new_int()
              {
                  ∙ ∙ ∙
                   // Initial processing here
                  ∙ ∙ ∙
                   // This is never executed
                   _chain_intr( old_int );
              }
 
     An interrupt handler should avoid calling the standard library
     functions, especially functions that rely on either INT 21H calls
     or BIOS calls. Functions that rely on INT 21H calls include I/O
     functions and _dosxxx functions. Functions that rely on the BIOS
     include graphics functions and _biosxxx functions.
 
     It may be safe to use functions that do not rely on INT 21H or
     BIOS, such as string-handling functions. Before calling a standard
     library function in an interrupt handler, be sure that you are
     familiar with the library function and what it does.
                                    -♦-