diff options
Diffstat (limited to 'srclib/apr/poll/unix/pollset.c')
-rw-r--r-- | srclib/apr/poll/unix/pollset.c | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/srclib/apr/poll/unix/pollset.c b/srclib/apr/poll/unix/pollset.c index 5ad70c99..1a7396b4 100644 --- a/srclib/apr/poll/unix/pollset.c +++ b/srclib/apr/poll/unix/pollset.c @@ -33,31 +33,23 @@ static apr_pollset_method_e pollset_default_method = POLLSET_DEFAULT_METHOD; #if !APR_FILES_AS_SOCKETS #if defined (WIN32) -extern apr_status_t -apr_file_socket_pipe_create(apr_file_t **in, - apr_file_t **out, - apr_pool_t *p); - -extern apr_status_t -apr_file_socket_pipe_close(apr_file_t *file); - /* Create a dummy wakeup socket pipe for interrupting the poller */ static apr_status_t create_wakeup_pipe(apr_pollset_t *pollset) { apr_status_t rv; - apr_pollfd_t fd; if ((rv = apr_file_socket_pipe_create(&pollset->wakeup_pipe[0], &pollset->wakeup_pipe[1], pollset->pool)) != APR_SUCCESS) return rv; - fd.reqevents = APR_POLLIN; - fd.desc_type = APR_POLL_FILE; - fd.desc.f = pollset->wakeup_pipe[0]; - /* Add the pipe to the pollset - */ - return apr_pollset_add(pollset, &fd); + + pollset->wakeup_pfd.p = pollset->pool; + pollset->wakeup_pfd.reqevents = APR_POLLIN; + pollset->wakeup_pfd.desc_type = APR_POLL_FILE; + pollset->wakeup_pfd.desc.f = pollset->wakeup_pipe[0]; + + return apr_pollset_add(pollset, &pollset->wakeup_pfd); } #else /* !WIN32 */ @@ -79,15 +71,16 @@ static apr_status_t apr_file_socket_pipe_close(apr_file_t *file) static apr_status_t create_wakeup_pipe(apr_pollset_t *pollset) { apr_status_t rv; - apr_pollfd_t fd; if ((rv = apr_file_pipe_create(&pollset->wakeup_pipe[0], &pollset->wakeup_pipe[1], pollset->pool)) != APR_SUCCESS) return rv; - fd.reqevents = APR_POLLIN; - fd.desc_type = APR_POLL_FILE; - fd.desc.f = pollset->wakeup_pipe[0]; + + pollset->wakeup_pfd.p = pollset->pool; + pollset->wakeup_pfd.reqevents = APR_POLLIN; + pollset->wakeup_pfd.desc_type = APR_POLL_FILE; + pollset->wakeup_pfd.desc.f = pollset->wakeup_pipe[0]; { int flags; @@ -110,9 +103,7 @@ static apr_status_t create_wakeup_pipe(apr_pollset_t *pollset) return errno; } - /* Add the pipe to the pollset - */ - return apr_pollset_add(pollset, &fd); + return apr_pollset_add(pollset, &pollset->wakeup_pfd); } #endif /* !APR_FILES_AS_SOCKETS */ @@ -125,7 +116,7 @@ void apr_pollset_drain_wakeup_pipe(apr_pollset_t *pollset) while (apr_file_read(pollset->wakeup_pipe[0], rb, &nr) == APR_SUCCESS) { /* Although we write just one byte to the other end of the pipe - * during wakeup, multiple treads could call the wakeup. + * during wakeup, multiple threads could call the wakeup. * So simply drain out from the input side of the pipe all * the data. */ @@ -272,6 +263,9 @@ APR_DECLARE(apr_status_t) apr_pollset_create_ex(apr_pollset_t **ret_pollset, } pollset->provider = provider; } + else if (rv != APR_SUCCESS) { + return rv; + } if (flags & APR_POLLSET_WAKEABLE) { /* Create wakeup pipe */ if ((rv = create_wakeup_pipe(pollset)) != APR_SUCCESS) { |