summaryrefslogtreecommitdiff
path: root/poll/unix/pollset.c
diff options
context:
space:
mode:
authorIvan Zhakov <ivan@apache.org>2022-02-15 13:05:37 +0000
committerIvan Zhakov <ivan@apache.org>2022-02-15 13:05:37 +0000
commitee6ba053c3b032b1ac7c4c515af6a32b0090c04b (patch)
tree0c918c8508555eb177419aea175c19bb78df6086 /poll/unix/pollset.c
parent388b2eab44cd1afe6f7af226cc894a15af4ff398 (diff)
downloadapr-1.8.x-r1897895.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/pollset.c')
-rw-r--r--poll/unix/pollset.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/poll/unix/pollset.c b/poll/unix/pollset.c
index 57374a5e7..6a2013637 100644
--- a/poll/unix/pollset.c
+++ b/poll/unix/pollset.c
@@ -38,7 +38,11 @@ static apr_status_t pollset_cleanup(void *p)
(*pollset->provider->cleanup)(pollset);
}
if (pollset->flags & APR_POLLSET_WAKEABLE) {
+#if WAKEUP_USES_PIPE
apr_poll_close_wakeup_pipe(pollset->wakeup_pipe);
+#else
+ apr_poll_close_wakeup_socket(pollset->wakeup_socket);
+#endif
}
return APR_SUCCESS;
@@ -166,13 +170,21 @@ APR_DECLARE(apr_status_t) apr_pollset_create_ex(apr_pollset_t **ret_pollset,
return rv;
}
if (flags & APR_POLLSET_WAKEABLE) {
+#if WAKEUP_USES_PIPE
/* Create wakeup pipe */
if ((rv = apr_poll_create_wakeup_pipe(pollset->pool, &pollset->wakeup_pfd,
pollset->wakeup_pipe))
!= APR_SUCCESS) {
return rv;
}
-
+#else
+ /* Create wakeup socket */
+ if ((rv = apr_poll_create_wakeup_socket(pollset->pool, &pollset->wakeup_pfd,
+ pollset->wakeup_socket))
+ != APR_SUCCESS) {
+ return rv;
+ }
+#endif
if ((rv = apr_pollset_add(pollset, &pollset->wakeup_pfd)) != APR_SUCCESS) {
return rv;
}
@@ -225,8 +237,14 @@ APR_DECLARE(apr_status_t) apr_pollset_wakeup(apr_pollset_t *pollset)
if (!(pollset->flags & APR_POLLSET_WAKEABLE))
return APR_EINIT;
- if (apr_atomic_cas32(&pollset->wakeup_set, 1, 0) == 0)
+ if (apr_atomic_cas32(&pollset->wakeup_set, 1, 0) == 0) {
+#if WAKEUP_USES_PIPE
return apr_file_putc(1, pollset->wakeup_pipe[1]);
+#else
+ apr_size_t len = 1;
+ return apr_socket_send(pollset->wakeup_socket[1], "\1", &len);
+#endif
+ }
return APR_SUCCESS;
}