You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by yl...@apache.org on 2018/01/02 17:23:45 UTC
svn commit: r1819857 - /apr/apr/trunk/test/testpoll.c
Author: ylavic
Date: Tue Jan 2 17:23:45 2018
New Revision: 1819857
URL: http://svn.apache.org/viewvc?rev=1819857&view=rev
Log:
testpoll: check that the wakeup pipe is still in the pollset after returning
from poll(), e.g. APR_POLLSET_PORT should re-arm it automatically.
Modified:
apr/apr/trunk/test/testpoll.c
Modified: apr/apr/trunk/test/testpoll.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/testpoll.c?rev=1819857&r1=1819856&r2=1819857&view=diff
==============================================================================
--- apr/apr/trunk/test/testpoll.c (original)
+++ apr/apr/trunk/test/testpoll.c Tue Jan 2 17:23:45 2018
@@ -783,6 +783,7 @@ static void pollset_wakeup(abts_case *tc
apr_pollset_t *pollset;
apr_int32_t num;
const apr_pollfd_t *descriptors;
+ int i;
rv = apr_pollset_create_ex(&pollset, 1, p, APR_POLLSET_WAKEABLE,
default_pollset_impl);
@@ -792,12 +793,18 @@ static void pollset_wakeup(abts_case *tc
}
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
- /* send wakeup but no data; apr_pollset_poll() should return APR_EINTR */
- rv = apr_pollset_wakeup(pollset);
- ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
+ /* Send wakeup but no data; apr_pollset_poll() should return APR_EINTR.
+ * Do it twice to test implementations that need to re-arm the events after
+ * poll()ing (e.g. APR_POLLSET_PORT), hence verify that the wakeup pipe is
+ * still in the place afterward.
+ */
+ for (i = 0; i < 2; ++i) {
+ rv = apr_pollset_wakeup(pollset);
+ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
- rv = apr_pollset_poll(pollset, -1, &num, &descriptors);
- ABTS_INT_EQUAL(tc, APR_EINTR, rv);
+ rv = apr_pollset_poll(pollset, -1, &num, &descriptors);
+ ABTS_INT_EQUAL(tc, APR_EINTR, rv);
+ }
/* send wakeup and data; apr_pollset_poll() should return APR_SUCCESS */
socket_pollfd.desc_type = APR_POLL_SOCKET;