Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 92627 invoked from network); 13 Apr 2008 09:18:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Apr 2008 09:18:54 -0000 Received: (qmail 94058 invoked by uid 500); 13 Apr 2008 09:18:54 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 94017 invoked by uid 500); 13 Apr 2008 09:18:54 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Id: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 94004 invoked by uid 99); 13 Apr 2008 09:18:54 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 13 Apr 2008 02:18:54 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.9] (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with SMTP; Sun, 13 Apr 2008 09:18:10 +0000 Received: (qmail 92599 invoked by uid 2161); 13 Apr 2008 09:18:29 -0000 Received: from [192.168.2.4] (euler.heimnetz.de [192.168.2.4]) by cerberus.heimnetz.de (Postfix on SuSE Linux 7.0 (i386)) with ESMTP id D1ED61721C for ; Sun, 13 Apr 2008 11:18:16 +0200 (CEST) Message-ID: <4801CFDB.7000104@apache.org> Date: Sun, 13 Apr 2008 11:18:19 +0200 From: Ruediger Pluem User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.13) Gecko/20080313 SeaMonkey/1.1.9 MIME-Version: 1.0 To: dev@apr.apache.org Subject: Re: svn commit: r647540 - in /apr/apr/trunk: CHANGES include/apr_poll.h poll/unix/epoll.c poll/unix/kqueue.c poll/unix/poll.c poll/unix/port.c poll/unix/select.c test/testpoll.c References: <20080413083112.3124D1A9832@eris.apache.org> In-Reply-To: <20080413083112.3124D1A9832@eris.apache.org> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org On 04/13/2008 10:31 AM, mturk@apache.org wrote: > Author: mturk > Date: Sun Apr 13 01:31:03 2008 > New Revision: 647540 > > URL: http://svn.apache.org/viewvc?rev=647540&view=rev > Log: > Introduce apr_pollset_wakeup() > > Modified: > apr/apr/trunk/CHANGES > apr/apr/trunk/include/apr_poll.h > apr/apr/trunk/poll/unix/epoll.c > apr/apr/trunk/poll/unix/kqueue.c > apr/apr/trunk/poll/unix/poll.c > apr/apr/trunk/poll/unix/port.c > apr/apr/trunk/poll/unix/select.c > apr/apr/trunk/test/testpoll.c > > Modified: apr/apr/trunk/CHANGES > Modified: apr/apr/trunk/poll/unix/poll.c > URL: http://svn.apache.org/viewvc/apr/apr/trunk/poll/unix/poll.c?rev=647540&r1=647539&r2=647540&view=diff > ============================================================================== > --- apr/apr/trunk/poll/unix/poll.c (original) > +++ apr/apr/trunk/poll/unix/poll.c Sun Apr 13 01:31:03 2008 > @@ -242,32 +328,69 @@ > apr_int32_t *num, > const apr_pollfd_t **descriptors) > { > - int rv; > + int ret; > + apr_status_t rv = APR_SUCCESS; > apr_uint32_t i, j; > > if (timeout > 0) { > timeout /= 1000; > } > - rv = poll(pollset->pollset, pollset->nelts, timeout); > - (*num) = rv; > - if (rv < 0) { > + ret = poll(pollset->pollset, pollset->nelts, timeout); > + (*num) = ret; > + if (ret < 0) { > return apr_get_netos_error(); > } > - if (rv == 0) { > + else if (res == 0) { Shouldn't this be else if (ret == 0) { instead? And why do we need else? We have a return above. > return APR_TIMEUP; > } > - j = 0; > - for (i = 0; i < pollset->nelts; i++) { > - if (pollset->pollset[i].revents != 0) { > - pollset->result_set[j] = pollset->query_set[i]; > - pollset->result_set[j].rtnevents = > - get_revent(pollset->pollset[i].revents); > - j++; > + else { Why do we need else here? We do a return above. > + for (i = 0, j = 0; i < pollset->nelts; i++) { > + if (pollset->pollset[i].revents != 0) { > +#if APR_HAS_THREADS > + /* Check if the polled descriptor is our > + * wakeup pipe. In that case do not put it result set. > + */ > + if ((pollset->flags & APR_POLLSET_WAKEABLE) && > + pollset->pollset[i].desc_type == APR_POLL_FILE && > + pollset->pollset[i].desc.f == pollset->wakeup_pipe[0]) { > + drain_wakeup_pipe(pollset); > + /* XXX: Is this a correct return value ? > + * We might simply return APR_SUCEESS. > + */ > + rv = APR_EINTR; What is if we have at least two events: Some from "regular" fd(s) and one from our wakeup pipe? Shouldn't we ignore the fact that the wakeup pipe produced an event in this case and just proceed as this never happened and just return the results of the regular fd(s)? Of course the same applies to the epoll implementation. For sake of completeness, don't you need to adjust the OS/2 poll routines as well? Regards RĂ¼diger