From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 8 22:51:23 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D09C21065676 for ; Fri, 8 Aug 2008 22:51:23 +0000 (UTC) (envelope-from neldredge@math.ucsd.edu) Received: from euclid.ucsd.edu (euclid.ucsd.edu [132.239.145.52]) by mx1.freebsd.org (Postfix) with ESMTP id AD7948FC0C for ; Fri, 8 Aug 2008 22:51:23 +0000 (UTC) (envelope-from neldredge@math.ucsd.edu) Received: from zeno.ucsd.edu (zeno.ucsd.edu [132.239.145.22]) by euclid.ucsd.edu (8.11.7p3+Sun/8.11.7) with ESMTP id m78MpLB16030; Fri, 8 Aug 2008 15:51:21 -0700 (PDT) Received: from localhost (neldredg@localhost) by zeno.ucsd.edu (8.11.7p3+Sun/8.11.7) with ESMTP id m78MpLa15294; Fri, 8 Aug 2008 15:51:21 -0700 (PDT) X-Authentication-Warning: zeno.ucsd.edu: neldredg owned process doing -bs Date: Fri, 8 Aug 2008 15:51:21 -0700 (PDT) From: Nate Eldredge X-X-Sender: neldredg@zeno.ucsd.edu To: Chuck Robey In-Reply-To: <489CAC2F.1070907@telenix.org> Message-ID: References: <489B9D4D.4010009@telenix.org> <200808081009.56521.pieter@degoeje.nl> <489CAC2F.1070907@telenix.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: "Carlos A. M. dos Santos" , Pieter de Goeje , Nate Eldredge , freebsd-hackers@freebsd.org Subject: Re: read with timeout ?? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Aug 2008 22:51:23 -0000 On Fri, 8 Aug 2008, Chuck Robey wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Pieter de Goeje wrote: >> >> I think poll(2) is also simpler than select for this purpose. >> > > It does look like that, I need to check the implementation a bit, because the > name of this thing makes me really suspicious about how often it checks for an > fd for being ready for a read. I know select comes right back, I was under the > impression that poll didn't use signals to do this. AFAIK the effects are identical, just the arguments are set up in a different way. Both of them will block until the fd is ready and then return "immediately" (subject to other processes running of course). The name "poll" is a misnomer because it doesn't actually work by polling, but you can pretend that it does (and does so "infinitely often"). Neither one uses signals per se, though if the underlying hardware device is interrupt-driven, that will be what (indirectly) triggers the wake-up. poll does seem to be more convenient than messing about with fd_set's. select is older and so it comes to my mind first, that's all. -- Nate Eldredge neldredge@math.ucsd.edu