summaryrefslogtreecommitdiff
path: root/srclib/apr/poll/unix/pollset.c
diff options
context:
space:
mode:
authorStefan Fritsch <sf@sfritsch.de>2011-12-27 19:43:09 +0100
committerStefan Fritsch <sf@sfritsch.de>2011-12-27 19:43:09 +0100
commit5b56d06a01a150fc9685e6f913774be3f9deb49f (patch)
tree9fbfbe0313b782941f1c2c4d3cb5203817144108 /srclib/apr/poll/unix/pollset.c
parent498ea95018b369e62646a98c7d7d5413b56e170c (diff)
downloadapache2-5b56d06a01a150fc9685e6f913774be3f9deb49f.tar.gz
Upstream tarball 2.2.19upstream/2.2.19
Diffstat (limited to 'srclib/apr/poll/unix/pollset.c')
-rw-r--r--srclib/apr/poll/unix/pollset.c40
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) {