Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!nike!ucbcad!ucbvax!hplabs!sdcrdcf!usc-oberon!mcooper From: mcooper@usc-oberon.UUCP (Michael A. Cooper) Newsgroups: net.unix-wizards Subject: alarms during a read() Message-ID: <667@usc-oberon.UUCP> Date: Mon, 4-Aug-86 19:38:53 EDT Article-I.D.: usc-ober.667 Posted: Mon Aug 4 19:38:53 1986 Date-Received: Thu, 7-Aug-86 03:07:46 EDT Distribution: net Organization: USC Computing Services, Los Angeles Lines: 44 -=-= [VAX 4.2BSD] I've been trying to figure out how to jump out of a read() via a signal alarm. My problem is that things wedge up when (apparantly) read() is restarted when the alarm goes off. This occurs when there is no input for read() to read. Hence, wakeup() is never called by the alarm. Below is the basic code: signal(SIGALRM, wakeup); alarm(3); recvbuf[0] = getch(); alarm(0); And here's getch()... getch() { char c; (void) read(0, &c, 1); return(c & 0377); } According to the signal(3c) manual: "If a caught signal occurs during certain system calls, caus- ing the call to terminate prematurely, the call is automati- cally restarted. In particular this can occur during a read or write(2) on a slow device (such as a terminal; but not a file) and during a wait(2)." I assume this is my problem. Now, has anyone figured out a way around this? It seems that catching a signal during certain system calls should not be a problem. It's not too much to ask for, is it? -- Michael Cooper, U of Southern California Computing Services, (213) 743-3462 UUCP: {sdcrdcf, uscvax}!usc-oberon!mcooper ARPA: mcooper@usc-oberon.arpa BITNET: mcooper@uscvaxq