From owner-freebsd-hackers Tue Apr 20 2:53:11 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from news.IAEhv.nl (news.IAE.nl [194.151.64.4]) by hub.freebsd.org (Postfix) with ESMTP id 3E7B21555E for ; Tue, 20 Apr 1999 02:53:07 -0700 (PDT) (envelope-from marc@bowtie.nl) Received: (from uucp@localhost) by news.IAEhv.nl (8.9.1/8.9.1) with IAEhv.nl id LAA11298; Tue, 20 Apr 1999 11:50:07 +0200 (MET DST) Received: from localhost (localhost [127.0.0.1]) by bowtie.nl (8.8.8/8.8.8) with ESMTP id LAA28715; Tue, 20 Apr 1999 11:45:09 +0200 (CEST) (envelope-from marc@bowtie.nl) Message-Id: <199904200945.LAA28715@bowtie.nl> X-Mailer: exmh version 2.0.2 2/24/98 To: Graham Wheeler Cc: hackers@FreeBSD.ORG Subject: Re: Using select() to implement a delay In-reply-to: gram's message of Tue, 20 Apr 1999 11:21:21 +0200. <199904200921.LAA09941@cdsec.com> Reply-To: marc@bowtie.nl Date: Tue, 20 Apr 1999 11:45:08 +0200 From: Marc van Kempen Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > 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. > > On my development machine, Sleep(60) does exactly what is expected. On > my clients machine, Sleep(60) returns immediately. Both are running > FreeBSD 2.2.7. I don't have access to the clients machine, which is > in another city, and has no development environment, so I can't run gdb, > although it may not give away anything in any case. > > Does anyone have any ideas why the one works and the other doesn't? > Did you try catching the return value from select, it might be getting a signal. Marc. ---------------------------------------------------- Marc van Kempen BowTie Technology Email: marc@bowtie.nl WWW & Databases tel. +31 40 2 43 20 65 fax. +31 40 2 44 21 86 http://www.bowtie.nl ---------------------------------------------------- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message