Path: utzoo!utgpu!water!watmath!clyde!rutgers!husc6!bu-cs!madd From: madd@bu-cs.BU.EDU (Jim Frost) Newsgroups: comp.sys.ibm.pc Subject: Re: MS-DOS interrupt chaining question Message-ID: <19794@bu-cs.BU.EDU> Date: 9 Feb 88 21:22:21 GMT References: <11223@shemp.UCLA.EDU> Reply-To: madd@bu-it.bu.edu (Jim Frost) Followup-To: comp.sys.ibm.pc Organization: Boston University Distributed Systems Group Lines: 26 In article <11223@shemp.UCLA.EDU> wales@CS.UCLA.EDU (Rich Wales) writes: >I am writing a subroutine library for the PC (8088-based architecture) >which catches the hardware clock interrupt, does some processing, and >then chains back to whatever was previously set up to catch the clock >interrupt. > >The programs that will use this library are *not* terminate-and-stay- >resident (TSR). Hence, my understanding is that it is *essential* that >the library's clock interrupt handler be unchained (and the original >clock interrupt vector value restored) by explicit program action before >the program goes away. [...] > >What I would like to know is whether there is any way I can [...] >always [clean] up when the program exits, no matter how said >exit takes place. About the easiest and most reliable way to do this would be to bootstrap your program. Make a small program that locks onto the clock interrupt and then exec's the full program. No matter how the full program exits (aside from a system crash and that really wouldn't matter) control will be returned to the smaller program, which can unlock from the clock. Communicating between the two programs is trivial enough and is left as an exercise to the reader. jim frost madd@bu-it.bu.edu