Date: Sun, 18 May 1997 15:07:12 +0400 (MSD) From: =?KOI8-R?B?4c7E0sXKIP7F0s7P1w==?= <ache@nagual.pp.ru> To: Peter Wemm <peter@spinner.dialix.com> Cc: Bruce Evans <bde@zeta.org.au>, peter@FreeBSD.ORG, cvs-all@FreeBSD.ORG, cvs-committers@FreeBSD.ORG, cvs-lib@FreeBSD.ORG Subject: Re: cvs commit: src/lib/libc/gen sleep.c Message-ID: <Pine.BSF.3.96.970518150412.1533B-100000@nagual.pp.ru> In-Reply-To: <199705180940.RAA06430@spinner.DIALix.COM>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 18 May 1997, Peter Wemm wrote: > (void) sigvec(SIGALRM, &vec, &ovec); > if (setjmp(&jmpbuf) == 0) { > .. unmask SIGALRM .. I think here is a race place --> > nanosleep(&time_to_sleep, &time_remaining); > (void) sigvec(SIGALRM, &ovec, (struct sigvec *)0); > ... but this has several problems.. > 1: it's starting to get messy with lots of syscalls. > 2: it doesn't deal with an aborted nanosleep() due to SIGALRM. It'd have > to calculate the elapsed time itself by calling gettimeofday or > clock_gettime() before and after. It'd also suffer from time adjustments > and contribute to the mess. Yes. > On the other hand, perhaps we could change the nanosleep syscall so that > it takes a mask argument and handle the differences in the libc wrapper > and have sleep(3) do this: > > > sigprocmask(SIG_BLOCK, ..SIGALRM.., &oset); > ... > setsignal(SIGALRM, sleephandler); > ... > nanosleep_mask(&time, &remaining, &oset); > ... > > and have nanosleep(ts1, ts2) be implemented as nanosleep_mask(ts1, ts2, > NULL); The second variant looks much better. -- Andrey A. Chernov <ache@null.net> http://www.nagual.pp.ru/~ache/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.970518150412.1533B-100000>