From owner-freebsd-hackers Tue Apr 20 8:31:21 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from obie.softweyr.com (unknown [204.68.178.33]) by hub.freebsd.org (Postfix) with ESMTP id 9FD7114FD4 for ; Tue, 20 Apr 1999 08:31:13 -0700 (PDT) (envelope-from wes@softweyr.com) Received: from softweyr.com (homer.softweyr.com [204.68.178.39]) by obie.softweyr.com (8.8.8/8.8.8) with ESMTP id JAA27811; Tue, 20 Apr 1999 09:28:29 -0600 (MDT) (envelope-from wes@softweyr.com) Message-ID: <371C9D1D.CBBB6A8F@softweyr.com> Date: Tue, 20 Apr 1999 09:28:29 -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: <199904200921.LAA09941@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: > > Hi all > > I have an interesting problem. I have a routine to implement delays: > > void Sleep(int secs, int usecs = 0) > { > struct timeval tv; > tv.tv_sec = secs; > tv.tv_usec = usecs; > (void)select(0, 0, 0, 0, &tv); > } > > 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)? -- "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