Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 exptools; site whuxl.UUCP Path: utzoo!watmath!clyde!cbosgd!ihnp4!houxm!whuxl!mike From: mike@whuxl.UUCP (BALDWIN) Newsgroups: net.unix-wizards Subject: sleep problems Message-ID: <521@whuxl.UUCP> Date: Fri, 15-Mar-85 20:58:36 EST Article-I.D.: whuxl.521 Posted: Fri Mar 15 20:58:36 1985 Date-Received: Sat, 16-Mar-85 23:59:37 EST Distribution: net Organization: /usr/exptools/lib/netnews/myorg Lines: 27 System V doesn't have the sleep(1) == sleep(INFIN) problem because it uses setjmp/longjmp to catch the alarm: sleep(amt) { ... signal(SIGALRM, catch); if (setjmp(buf) == 0) { alarm(amt); pause(); } ... } catch() { longjmp(buf, 1); } So if the alarm comes in before the pause, it will skip over the pause. Unfortunately, the longjmp causes a particularly bad thing to happen: if another signal is caught while the sleep is pausing, and the alarm goes off before the signal routine has returned, that signal routine will be cut off in the middle! Michael Baldwin AT&T Bell Labs harpo!whuxl!mike