diff options
author | Ivan Zhakov <ivan@apache.org> | 2022-02-15 13:05:37 +0000 |
---|---|---|
committer | Ivan Zhakov <ivan@apache.org> | 2022-02-15 13:05:37 +0000 |
commit | ee6ba053c3b032b1ac7c4c515af6a32b0090c04b (patch) | |
tree | 0c918c8508555eb177419aea175c19bb78df6086 /poll/unix/pollcb.c | |
parent | 388b2eab44cd1afe6f7af226cc894a15af4ff398 (diff) | |
download | apr-ee6ba053c3b032b1ac7c4c515af6a32b0090c04b.tar.gz |
On '1.8.x-r1897895' branch: Backport r1897895 from trunk.1.8.x-r1897895
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.8.x-r1897895@1898104 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poll/unix/pollcb.c')
-rw-r--r-- | poll/unix/pollcb.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/poll/unix/pollcb.c b/poll/unix/pollcb.c index 103ab9fa6..144669629 100644 --- a/poll/unix/pollcb.c +++ b/poll/unix/pollcb.c @@ -82,7 +82,11 @@ static apr_status_t pollcb_cleanup(void *p) (*pollcb->provider->cleanup)(pollcb); } if (pollcb->flags & APR_POLLSET_WAKEABLE) { +#if WAKEUP_USES_PIPE apr_poll_close_wakeup_pipe(pollcb->wakeup_pipe); +#else + apr_poll_close_wakeup_socket(pollcb->wakeup_socket); +#endif } return APR_SUCCESS; @@ -163,12 +167,21 @@ APR_DECLARE(apr_status_t) apr_pollcb_create_ex(apr_pollcb_t **ret_pollcb, } if (flags & APR_POLLSET_WAKEABLE) { +#if WAKEUP_USES_PIPE /* Create wakeup pipe */ if ((rv = apr_poll_create_wakeup_pipe(pollcb->pool, &pollcb->wakeup_pfd, - pollcb->wakeup_pipe)) - != APR_SUCCESS) { + pollcb->wakeup_pipe)) + != APR_SUCCESS) { + return rv; + } +#else + /* Create wakeup socket */ + if ((rv = apr_poll_create_wakeup_socket(pollcb->pool, &pollcb->wakeup_pfd, + pollcb->wakeup_socket)) + != APR_SUCCESS) { return rv; } +#endif if ((rv = apr_pollcb_add(pollcb, &pollcb->wakeup_pfd)) != APR_SUCCESS) { return rv; @@ -217,8 +230,14 @@ APR_DECLARE(apr_status_t) apr_pollcb_wakeup(apr_pollcb_t *pollcb) if (!(pollcb->flags & APR_POLLSET_WAKEABLE)) return APR_EINIT; - if (apr_atomic_cas32(&pollcb->wakeup_set, 1, 0) == 0) + if (apr_atomic_cas32(&pollcb->wakeup_set, 1, 0) == 0) { +#if WAKEUP_USES_PIPE return apr_file_putc(1, pollcb->wakeup_pipe[1]); +#else + apr_size_t len = 1; + return apr_socket_send(pollcb->wakeup_socket[1], "\1", &len); +#endif + } return APR_SUCCESS; } |