summaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
authorBrian Pane <brianp@apache.org>2005-07-09 07:07:17 +0000
committerBrian Pane <brianp@apache.org>2005-07-09 07:07:17 +0000
commit98474c81a37275f5a637a88ae444ad1bb3657537 (patch)
tree6afdaaa9b3b6ec5d951093f8e32705fe69420ce4 /support
parent0feadb042bbffdf53d2e2b89abfea94303ebe8e6 (diff)
downloadapr-98474c81a37275f5a637a88ae444ad1bb3657537.tar.gz
Added lazy evaluation of the pollset that's used within apr_file_t
on platforms where apr_wait_for_io_or_timeout does not use poll(2). This is a performance fix for httpd-2.x running on OS X, where the creation of an unused, kqueue-based apr_pollset_t on every file open and every file setaside was consuming a noticeable amount of CPU time. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@209931 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'support')
-rw-r--r--support/unix/waitio.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/support/unix/waitio.c b/support/unix/waitio.c
index 81fea536b..167ad6d08 100644
--- a/support/unix/waitio.c
+++ b/support/unix/waitio.c
@@ -61,7 +61,7 @@ apr_status_t apr_wait_for_io_or_timeout(apr_file_t *f, apr_socket_t *s,
}
}
-#else
+#else /* !WAITIO_USES_POLL */
apr_status_t apr_wait_for_io_or_timeout(apr_file_t *f, apr_socket_t *s,
int for_read)
@@ -78,6 +78,13 @@ apr_status_t apr_wait_for_io_or_timeout(apr_file_t *f, apr_socket_t *s,
pfd.desc.f = f;
pollset = f->pollset;
+ if (pollset == NULL) {
+ status = apr_pollset_create(&(f->pollset), 1, f->pool, 0);
+ if (status != APR_SUCCESS) {
+ return status;
+ }
+ pollset = f->pollset;
+ }
timeout = f->timeout;
}
else {