summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorIvan Zhakov <ivan@apache.org>2022-01-19 16:41:59 +0000
committerIvan Zhakov <ivan@apache.org>2022-01-19 16:41:59 +0000
commit20fc9a4b4630397d080996548cd3c3d313b8c601 (patch)
treef230048f85a0484fbcd65959101b0f9e609963fd /include
parent544428e7120ac244f0a09ddf3463a0f4b42ee436 (diff)
downloadapr-20fc9a4b4630397d080996548cd3c3d313b8c601.tar.gz
On 'win32-pollset-wakeup-no-file-socket-emulation' branch:
Windows: For the pollset wakeup, use apr_socket_t directly instead of using a socket disguised as an apr_file_t. * file_io/win32/pipe.c (): Include apr_arch_networkio.h. (socket_pipe_cleanup, apr_file_socket_pipe_create, apr_file_socket_pipe_close): Update to use apr_socket_t instead of apr_file_t. * include/arch/unix/apr_arch_poll_private.h (WAKEUP_USES_PIPE): New #define to specify mechanism used for pollset wakeup. (apr_pollset_t, apr_pollcb_t): Add wakeup_socket if not WAKEUP_USES_PIPE. (apr_poll_create_wakeup_socket, apr_poll_close_wakeup_socket, apr_poll_drain_wakeup_socket): Declare if not WAKEUP_USES_PIPE. * include/arch/win32/apr_arch_file_io.h (apr_file_socket_pipe_create, apr_file_socket_pipe_close): Update to use apr_socket_t instead of apr_file_t. * poll/unix/poll.c (impl_pollset_add): Remove hack that allows apr_file_t even if APR_FILES_AS_SOCKETS == 0. (impl_pollset_poll, impl_pollcb_poll): Use wakeup_pipe or wakeup_socket depending of WAKEUP_USES_PIPE. * poll/unix/pollcb.c (pollcb_cleanup, apr_pollcb_create_ex, apr_pollcb_wakeup): Use wakeup_pipe or wakeup_socket depending of WAKEUP_USES_PIPE. * poll/unix/pollset.c (pollset_cleanup, apr_pollset_create_ex, apr_pollset_wakeup): Use wakeup_pipe or wakeup_socket depending of WAKEUP_USES_PIPE. * poll/unix/select.c (impl_pollset_add): Remove hack that allows apr_file_t even if APR_FILES_AS_SOCKETS == 0. (impl_pollset_poll): Use wakeup_pipe or wakeup_socket depending of WAKEUP_USES_PIPE. * poll/unix/wakeup.c (apr_poll_create_wakeup_pipe): Rename to apr_poll_create_wakeup_socket() on Windows and use apr_socket_t instead of apr_file_t. (apr_poll_close_wakeup_pipe): Rename to apr_poll_close_wakeup_socket() on Windows and use apr_socket_t instead of apr_file_t. (apr_poll_drain_wakeup_socket): New. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/win32-pollset-wakeup-no-file-socket-emulation@1897208 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include')
-rw-r--r--include/arch/unix/apr_arch_poll_private.h23
-rw-r--r--include/arch/win32/apr_arch_file_io.h6
2 files changed, 25 insertions, 4 deletions
diff --git a/include/arch/unix/apr_arch_poll_private.h b/include/arch/unix/apr_arch_poll_private.h
index 8dd97d1ad..7b91963a6 100644
--- a/include/arch/unix/apr_arch_poll_private.h
+++ b/include/arch/unix/apr_arch_poll_private.h
@@ -81,6 +81,12 @@
#endif
#endif
+#ifdef WIN32
+#define WAKEUP_USES_PIPE 0
+#else
+#define WAKEUP_USES_PIPE 1
+#endif
+
#if defined(POLLSET_USES_KQUEUE) || defined(POLLSET_USES_EPOLL) || defined(POLLSET_USES_PORT) || defined(POLLSET_USES_AIO_MSGQ)
#include "apr_ring.h"
@@ -121,7 +127,11 @@ struct apr_pollset_t
apr_uint32_t nalloc;
apr_uint32_t flags;
/* Pipe descriptors used for wakeup */
+#if WAKEUP_USES_PIPE
apr_file_t *wakeup_pipe[2];
+#else
+ apr_socket_t *wakeup_socket[2];
+#endif
apr_pollfd_t wakeup_pfd;
volatile apr_uint32_t wakeup_set;
apr_pollset_private_t *p;
@@ -150,7 +160,11 @@ struct apr_pollcb_t {
apr_uint32_t nalloc;
apr_uint32_t flags;
/* Pipe descriptors used for wakeup */
+#if WAKEUP_USES_PIPE
apr_file_t *wakeup_pipe[2];
+#else
+ apr_socket_t *wakeup_socket[2];
+#endif
apr_pollfd_t wakeup_pfd;
volatile apr_uint32_t wakeup_set;
int fd;
@@ -181,9 +195,16 @@ struct apr_pollcb_provider_t {
* Private functions used for the implementation of both apr_pollcb_* and
* apr_pollset_*
*/
-apr_status_t apr_poll_create_wakeup_pipe(apr_pool_t *pool, apr_pollfd_t *pfd,
+#if WAKEUP_USES_PIPE
+apr_status_t apr_poll_create_wakeup_pipe(apr_pool_t *pool, apr_pollfd_t *pfd,
apr_file_t **wakeup_pipe);
apr_status_t apr_poll_close_wakeup_pipe(apr_file_t **wakeup_pipe);
void apr_poll_drain_wakeup_pipe(volatile apr_uint32_t *wakeup_set, apr_file_t **wakeup_pipe);
+#else
+apr_status_t apr_poll_create_wakeup_socket(apr_pool_t *pool, apr_pollfd_t *pfd,
+ apr_socket_t **wakeup_socket);
+apr_status_t apr_poll_close_wakeup_socket(apr_socket_t **wakeup_socket);
+void apr_poll_drain_wakeup_socket(volatile apr_uint32_t *wakeup_set, apr_socket_t **wakeup_socket);
+#endif
#endif /* APR_ARCH_POLL_PRIVATE_H */
diff --git a/include/arch/win32/apr_arch_file_io.h b/include/arch/win32/apr_arch_file_io.h
index f3ca4feeb..f5d20514b 100644
--- a/include/arch/win32/apr_arch_file_io.h
+++ b/include/arch/win32/apr_arch_file_io.h
@@ -251,11 +251,11 @@ apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p);
apr_status_t file_cleanup(void *);
extern apr_status_t
-apr_file_socket_pipe_create(apr_file_t **in,
- apr_file_t **out,
+apr_file_socket_pipe_create(apr_socket_t **in,
+ apr_socket_t **out,
apr_pool_t *p);
extern apr_status_t
-apr_file_socket_pipe_close(apr_file_t *file);
+apr_file_socket_pipe_close(apr_socket_t *socket);
#endif /* ! FILE_IO_H */