diff options
author | Brian Pane <brianp@apache.org> | 2005-10-23 06:46:00 +0000 |
---|---|---|
committer | Brian Pane <brianp@apache.org> | 2005-10-23 06:46:00 +0000 |
commit | e0b3cdeeace7fda9ddb392e4c25d213f9453d75d (patch) | |
tree | a502f07a29f2501d4bfb8ca488bcb69c678e6f59 | |
parent | 40e5bd5e0812425197afcbdb6238d9915cab3db6 (diff) | |
download | httpd-async-dev.tar.gz |
Use the new APR_POLLSET_NOCOPY option when creating the core pollset.async-dev
This eliminates the descriptor copying and mutex operations, and
O(n)-time apr_pollset_remove() loop when used with an apr_pollset
implementation that support the no-copy optimization.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/async-dev@327757 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | server/mpm/experimental/event/event.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/server/mpm/experimental/event/event.c b/server/mpm/experimental/event/event.c index 1a927241ca..f508cfeb22 100644 --- a/server/mpm/experimental/event/event.c +++ b/server/mpm/experimental/event/event.c @@ -891,7 +891,7 @@ static void *listener_thread(apr_thread_t * thd, void *dummy) /* Create the main pollset */ rc = apr_pollset_create(&event_pollset, ap_threads_per_child, - tpool, APR_POLLSET_THREADSAFE); + tpool, APR_POLLSET_THREADSAFE | APR_POLLSET_NOCOPY); if (rc != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, rc, ap_server_conf, "apr_pollset_create with Thread Safety failed. " @@ -901,19 +901,19 @@ static void *listener_thread(apr_thread_t * thd, void *dummy) } for (lr = ap_listeners; lr != NULL; lr = lr->next) { - apr_pollfd_t pfd = { 0 }; + apr_pollfd_t *pfd = apr_palloc(tpool, sizeof(*pfd)); pt = apr_pcalloc(tpool, sizeof(*pt)); - pfd.desc_type = APR_POLL_SOCKET; - pfd.desc.s = lr->sd; - pfd.reqevents = APR_POLLIN; + pfd->desc_type = APR_POLL_SOCKET; + pfd->desc.s = lr->sd; + pfd->reqevents = APR_POLLIN; pt->type = PT_ACCEPT; pt->baton = lr; - pfd.client_data = pt; + pfd->client_data = pt; - apr_socket_opt_set(pfd.desc.s, APR_SO_NONBLOCK, 1); - apr_pollset_add(event_pollset, &pfd); + apr_socket_opt_set(pfd->desc.s, APR_SO_NONBLOCK, 1); + apr_pollset_add(event_pollset, pfd); } /* Unblock the signal used to wake this thread up, and set a handler for @@ -2201,7 +2201,7 @@ static int worker_pre_config(apr_pool_t * pconf, apr_pool_t * plog, if (restart_num++ == 1) { is_graceful = 0; rv = apr_pollset_create(&event_pollset, 1, plog, - APR_POLLSET_THREADSAFE); + APR_POLLSET_THREADSAFE | APR_POLLSET_NOCOPY); if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, "Couldn't create a Thread Safe Pollset. " |