Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site ucbvax.ARPA Path: utzoo!watmath!clyde!burl!ulysses!ucbvax!engvax!KVC@cit-vax From: KVC%cit-vax@engvax.UUCP Newsgroups: fa.info-vax Subject: Re: VAX11-C V2.0 Signals Message-ID: <8508292333.AA01443@cit-vax.ARPA> Date: Thu, 29-Aug-85 19:33:24 EDT Article-I.D.: cit-vax.8508292333.AA01443 Posted: Thu Aug 29 19:33:24 1985 Date-Received: Sat, 31-Aug-85 05:45:24 EDT Sender: daemon@ucbvax.ARPA Reply-To: info-vax@ucb-vax.berkeley.edu Organization: The ARPA Internet Lines: 44 Yeah, I'm having a problem with signals and longjmp as well. In my case, the following simple program doesn't work: ---------------------------------------------------------------------------- #include #include #include jmp_buf buf; alarmtr() { longjmp(buf, 1); } main() { if (setjmp(buf)) { puts("This line should print every 5 secs forever!"); } signal(SIGALRM, alarmtr); alarm(5); pause(); } ---------------------------------------------------------------------------- This program seems to have two problems. First of all, the signal only gets handled once (like in C V1). The program also exhibits some weird behaviour in the pause() call -- it actually manages to exit, which should be impossible. Somehow, the alarm manages to queue 2 wakeup requests, so the second time it goes into pause(), there is an extra wakeup request hanging around and the program wakes up without going to alarmtr and exits to DCL! I have SPR'ed this, but haven't gotten an answer yet (and it's been many weeks). With an infinite loop instead of a pause, it only gets one signal. In C V1, it was documented that longjmp and signals didn't work right, since you were left at AST level and future signals got ignored. This is supposedly fixed in V2, but it doesn't seem to be. For whatever reason, future signals are still ignored after a longjmp out of a signal handler. In V1 I had a work around with a neat little piece of macro that faked an AST dismissal without exiting the AST routine, but that doesn't work in C V2. So, I am stuck with a big piece of code I cannot recompile. Yuck. /Kevin Carosso engvax!kvc @ CIT-VAX.ARPA Hughes Aircraft Co.