apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yla...@apache.org
Subject svn commit: r1755740 - /apr/apr/trunk/poll/os2/pollset.c
Date Wed, 10 Aug 2016 13:27:01 GMT
Author: ylavic
Date: Wed Aug 10 13:27:00 2016
New Revision: 1755740

URL: http://svn.apache.org/viewvc?rev=1755740&view=rev
Log:
apr_pollset_poll(): OS/2: follow up to r923311.
Don't return APR_EINTR (woken up) unless we actually read something on the
wakeup pipe (which we must drain), and also return APR_SUCCESS if at least
some other event is available simultaneously.


Modified:
    apr/apr/trunk/poll/os2/pollset.c

Modified: apr/apr/trunk/poll/os2/pollset.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/poll/os2/pollset.c?rev=1755740&r1=1755739&r2=1755740&view=diff
==============================================================================
--- apr/apr/trunk/poll/os2/pollset.c (original)
+++ apr/apr/trunk/poll/os2/pollset.c Wed Aug 10 13:27:00 2016
@@ -266,15 +266,25 @@ APR_DECLARE(apr_status_t) apr_pollset_po
                 struct apr_sockaddr_t from_addr;
                 char buffer[16];
                 apr_size_t buflen;
-                rc = APR_EINTR;
-
-                do {
+                for (;;) {
                     buflen = sizeof(buffer);
-                } while (apr_socket_recvfrom(&from_addr, pollset->wake_listen, MSG_DONTWAIT,
buffer, &buflen) == APR_SUCCESS);
+                    rv = apr_socket_recvfrom(&from_addr, pollset->wake_listen,
+                                             MSG_DONTWAIT, buffer, &buflen);
+                    if (rv != APR_SUCCESS) {
+                        break;
+                    }
+                    /* Woken up, drain the pipe still. */
+                    rc = APR_EINTR;
+                    if (buflen < sizeof(buf)) {
+                        break;
+                    }
+                }
             }
             else {
                 pollset->result_set[*num] = pollset->query_set[i];
                 pollset->result_set[*num].rtnevents = rtnevents;
+                /* Event(s) besides wakeup pipe. */
+                rc = APR_SUCCESS;
                 (*num)++;
             }
         }



Mime
View raw message