Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 May 1997 18:38:59 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        bde@zeta.org.au, peter@spinner.dialix.com
Cc:        cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org, cvs-lib@FreeBSD.org, peter@FreeBSD.org
Subject:   Re: cvs commit: src/lib/libc/gen usleep.c
Message-ID:  <199705180838.SAA30604@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>> Where do those semantics appear?  The old behaviour was to return
>> early.  The man page said otherwise, but so does the BSD4.4-Lite man
>  ^^^^^
>Are you sure of that?  Both sleep() and usleep() do a 'while
>(!ringring) sigpause(...)'..  To my reading, it won't return early ever...

I haven't read the sources lately, but the example

	alarm(1);
	sleep(2);

has been been returning early (and not returning the remaining time so it
has been on my bug list) for years.

Erm, ringring is set after the first SIGALRM is caught, so sleep() and
usleep() return after the first alarm.  The loop prevents returning after
other signals are caught.  Catching alarms prevents external SIGALRMs
from killing the process.

POSIX.1 seems to specify returning early from sleep() whenever a signal
(of any type) is caught.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199705180838.SAA30604>