From owner-freebsd-hackers Tue Apr 20 18: 3:50 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from xylan.com (postal.xylan.com [208.8.0.248]) by hub.freebsd.org (Postfix) with ESMTP id D521915101 for ; Tue, 20 Apr 1999 18:03:46 -0700 (PDT) (envelope-from wes@softweyr.com) Received: from mailhub.xylan.com by xylan.com (8.8.7/SMI-SVR4 (xylan-mgw 2.2 [OUT])) id SAA08746; Tue, 20 Apr 1999 18:01:00 -0700 (PDT) Received: from omni.xylan.com by mailhub.xylan.com (SMI-8.6/SMI-SVR4 (mailhub 2.1 [HUB])) id SAA10058; Tue, 20 Apr 1999 18:01:01 -0700 Received: from softweyr.com (dyn5.utah.xylan.com) by omni.xylan.com (4.1/SMI-4.1 (xylan engr [SPOOL])) id AA29108; Tue, 20 Apr 99 18:00:58 PDT Message-Id: <371D234A.E5C2AD8D@softweyr.com> Date: Tue, 20 Apr 1999 19:00:58 -0600 From: Wes Peters Organization: Softweyr LLC X-Mailer: Mozilla 4.5 [en] (X11; U; FreeBSD 3.1-RELEASE i386) X-Accept-Language: en Mime-Version: 1.0 To: Graham Wheeler Cc: hackers@FreeBSD.ORG Subject: Re: Using select() to implement a delay References: <199904201316.PAA23736@labinfo.iet.unipi.it> <371CA30F.6F84565B@cdsec.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Graham Wheeler wrote: > > Luigi Rizzo wrote: > > > > > > I have an interesting problem. I have a routine to implement delays: > > ... > > > > I am using this both because it gives better resolution than sleep(), > > > > and also because it doesn't require the use of SIGALRM, which I am > > > > using elsewhere. > > > > > > Do you have any reasons not to use usleep(3) or nanosleep(2)? > > > > portability to other unixes... > > As well as the fact that usleep uses signals. Whatever gave you that idea? From the 3.1 man page for usleep: This function is implemented using nanosleep(2) by pausing for microseconds microseconds or until a signal occurs. Consequently, in this implementation, sleeping has no effect on the state of process timers, and there is no special handling for SIGALRM. NetBSD has the same implementation, apparently. -- "Where am I, and what am I doing in this handbasket?" Wes Peters Softweyr LLC http://www.softweyr.com/~softweyr wes@softweyr.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message