Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!jarthur!petunia!csuchico.edu!madams From: madams@ecst.csuchico.edu (Michael E. Adams) Newsgroups: comp.lang.c Subject: Re: TURBO C: signal(SIGINT, ); DOS calls ok from this handler. Message-ID: <1991Jan03.113611.4796@ecst.csuchico.edu> Date: 3 Jan 91 11:36:11 GMT References: <9975@pasteur.Berkeley.EDU> <15795.2780a5d4@levels.sait.edu.au> <10229@hydra.Helsinki.FI> Sender: news@ecst.csuchico.edu (USENET) Organization: California State University, Chico Lines: 36 >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@cscihp.ecst.csuchico.edu No BULL bandwidth |