Newsgroups: comp.unix.wizards Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: sleep(3) uses longjmp and SIGALRM Message-ID: <1988Sep29.173530.26161@utzoo.uucp> Organization: U of Toronto Zoology References: <1988Sep28.135914.25444@lsuc.uucp> Date: Thu, 29 Sep 88 17:35:30 GMT In article <1988Sep28.135914.25444@lsuc.uucp> dave@lsuc.uucp (David Sherman) writes: >Today someone asked me why sleep(3) is a library routine rather >than a system call, which I'd always thought it was. (This is a >v7-based UNIX, Perkin-Elmer's Edition VII.) So I read the code, >and was startled to find it uses SIGALRM and pause, with a longjmp >to put you back where you were. Yup. Sleep was a system call in V6, but in V7 it was superseded, in theory, by alarm. >No wonder I get funny interactions with my other uses of setjmp >and SIGALRM. I'm surprised some of it works at all. The sleep code does make an attempt to preserve an existing alarm setting, if any. -- The meek can have the Earth; | Henry Spencer at U of Toronto Zoology the rest of us have other plans.|uunet!attcan!utzoo!henry henry@zoo.toronto.edu