sleep(3) uses longjmp and SIGALRM
Henry Spencer
henry at utzoo.uucp
Fri Sep 30 03:35:30 AEST 1988
In article <1988Sep28.135914.25444 at lsuc.uucp> dave at 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 at zoo.toronto.edu
More information about the Comp.unix.wizards
mailing list