summaryrefslogtreecommitdiff
path: root/poll
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2016-08-10 13:27:00 +0000
committerYann Ylavic <ylavic@apache.org>2016-08-10 13:27:00 +0000
commit42d24612f7bcce7820ceb77a23f19a7d8b7e60d8 (patch)
tree9c781ac50bfa44e226791793bc685d6b58420d50 /poll
parentdd0791f2345e1545f1e7af3fe9b3905f5735ba46 (diff)
downloadapr-42d24612f7bcce7820ceb77a23f19a7d8b7e60d8.tar.gz
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. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1755740 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poll')
-rw-r--r--poll/os2/pollset.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/poll/os2/pollset.c b/poll/os2/pollset.c
index e1263b5f2..3fe2d3eb4 100644
--- a/poll/os2/pollset.c
+++ b/poll/os2/pollset.c
@@ -266,15 +266,25 @@ APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset,
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)++;
}
}