Date: Tue, 20 Apr 1999 09:28:29 -0600 From: Wes Peters <wes@softweyr.com> To: Graham Wheeler <gram@cdsec.com> Cc: hackers@FreeBSD.ORG Subject: Re: Using select() to implement a delay Message-ID: <371C9D1D.CBBB6A8F@softweyr.com> References: <199904200921.LAA09941@cdsec.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?371C9D1D.CBBB6A8F>