From owner-freebsd-hackers Tue Apr 20 2:23:44 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from citadel.cdsec.com (citadel.cdsec.com [192.96.22.18]) by hub.freebsd.org (Postfix) with ESMTP id 7F19F14C1B for ; Tue, 20 Apr 1999 02:23:30 -0700 (PDT) (envelope-from gram@cdsec.com) Received: (from nobody@localhost) by citadel.cdsec.com (8.9.3/8.9.3) id LAA18581 for ; Tue, 20 Apr 1999 11:21:03 +0200 (SAST) Received: by citadel via recvmail id 18579; Tue Apr 20 11:20:58 1999 From: Graham Wheeler Message-Id: <199904200921.LAA09941@cdsec.com> Subject: Using select() to implement a delay To: hackers@freebsd.org Date: Tue, 20 Apr 1999 11:21:21 +0200 (SAST) X-Mailer: ELM [version 2.4ME+ PL43 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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? TIA gram -- Dr Graham Wheeler E-mail: gram@cdsec.com Citadel Data Security Phone: +27(21)423-6065/6/7 Firewalls/Virtual Private Networks Fax: +27(21)24-3656 Internet/Intranet Network Specialists Data Security Products WWW: http://www.cdsec.com/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message