diff options
author | Yann Ylavic <ylavic@apache.org> | 2018-01-02 17:23:45 +0000 |
---|---|---|
committer | Yann Ylavic <ylavic@apache.org> | 2018-01-02 17:23:45 +0000 |
commit | e1daecaefc8aa2c77b9258444c2ad213c0ad0318 (patch) | |
tree | c2bbefa38dbfbc575c910e71b02fef3f45414ef4 /test/testpoll.c | |
parent | 6e2b43d058c8864e53f3cca4d959be2e62fc6e85 (diff) | |
download | apr-e1daecaefc8aa2c77b9258444c2ad213c0ad0318.tar.gz |
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.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1819857 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/testpoll.c')
-rw-r--r-- | test/testpoll.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/test/testpoll.c b/test/testpoll.c index 644983df3..9f90af2dd 100644 --- a/test/testpoll.c +++ b/test/testpoll.c @@ -783,6 +783,7 @@ static void pollset_wakeup(abts_case *tc, void *data) 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, void *data) } 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; |