TURBO C: signal(SIGINT, ); DOS calls ok from this handler.

Michael E. Adams madams at ecst.csuchico.edu
Thu Jan 3 22:36:11 AEST 1991



>there's little you can *realiably* do in a signal handler, just about
>the only thing is setting a flag.
>
>Lars Wirzenius

Your a little off base here.  DOS reentrance is not a problem when
servicing int 23h.   The default handler from signal(SIGINT, func);
is int 23h, however within the scope of your program you can define
func to be an alternate Ctrl-C handler!  func can, but does not need
to return to DOS, it can be as robust as needed.

"While in a Ctrl-C/Ctrl-Break handler, you can use any DOS function
needed to process the condition."

 DOS Programmer's Reference, 2nd Edition
 by Terry Dettmann (w/ 2nd Ed. revisions by Jim Kyle)
 Published by QUE (C) 1989  ISBN:0-88022-458-4

Also see MS 'C' 5.1 run-time library ref, pg. 543 for an example of
printf used with a Ctrl-C signal.

However Lars, you are quite correct about other types of int handlers
needing to be cautious about what DOS funtions they use.  It just
happens that int 23h is "defined" to be a special case! :-)

Hope this makes things a little more confusing! ;-)

         (___)      |  Michael E. Adams
         (o o)      |  Custom Computer Programming
  /-------\ /       |  P.O. Box 5027
 / |     ||O        |  Chico,  California  95927-5025    U.S.A.
*  ||,---||         |
   ~~    ~~         |  internet: madams at cscihp.ecst.csuchico.edu
No BULL bandwidth   |



More information about the Comp.lang.c mailing list