Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Use the new APR_POLLSET_NOCOPY option when creating the core pollset.

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
  • Loading branch information...
commit 301b5b8b1916d9d2a32b0cb2970c5af068ab5964 1 parent 692b113
authored October 23, 2005

Showing 1 changed file with 9 additions and 9 deletions. Show diff stats Hide diff stats

  1. 18  server/mpm/experimental/event/event.c
18  server/mpm/experimental/event/event.c
@@ -891,7 +891,7 @@ static void *listener_thread(apr_thread_t * thd, void *dummy)
891 891
     /* Create the main pollset */
892 892
     rc = apr_pollset_create(&event_pollset,
893 893
                             ap_threads_per_child,
894  
-                            tpool, APR_POLLSET_THREADSAFE);
  894
+                            tpool, APR_POLLSET_THREADSAFE | APR_POLLSET_NOCOPY);
895 895
     if (rc != APR_SUCCESS) {
896 896
         ap_log_error(APLOG_MARK, APLOG_ERR, rc, ap_server_conf,
897 897
                      "apr_pollset_create with Thread Safety failed. "
@@ -901,19 +901,19 @@ static void *listener_thread(apr_thread_t * thd, void *dummy)
901 901
     }
902 902
 
903 903
     for (lr = ap_listeners; lr != NULL; lr = lr->next) {
904  
-        apr_pollfd_t pfd = { 0 };
  904
+        apr_pollfd_t *pfd = apr_palloc(tpool, sizeof(*pfd));
905 905
         pt = apr_pcalloc(tpool, sizeof(*pt));
906  
-        pfd.desc_type = APR_POLL_SOCKET;
907  
-        pfd.desc.s = lr->sd;
908  
-        pfd.reqevents = APR_POLLIN;
  906
+        pfd->desc_type = APR_POLL_SOCKET;
  907
+        pfd->desc.s = lr->sd;
  908
+        pfd->reqevents = APR_POLLIN;
909 909
 
910 910
         pt->type = PT_ACCEPT;
911 911
         pt->baton = lr;
912 912
 
913  
-        pfd.client_data = pt;
  913
+        pfd->client_data = pt;
914 914
 
915  
-        apr_socket_opt_set(pfd.desc.s, APR_SO_NONBLOCK, 1);
916  
-        apr_pollset_add(event_pollset, &pfd);
  915
+        apr_socket_opt_set(pfd->desc.s, APR_SO_NONBLOCK, 1);
  916
+        apr_pollset_add(event_pollset, pfd);
917 917
     }
918 918
 
919 919
     /* 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,
2201 2201
     if (restart_num++ == 1) {
2202 2202
         is_graceful = 0;
2203 2203
         rv = apr_pollset_create(&event_pollset, 1, plog,
2204  
-                                APR_POLLSET_THREADSAFE);
  2204
+                                APR_POLLSET_THREADSAFE | APR_POLLSET_NOCOPY);
2205 2205
         if (rv != APR_SUCCESS) {
2206 2206
             ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
2207 2207
                          "Couldn't create a Thread Safe Pollset. "

0 notes on commit 301b5b8

Please sign in to comment.
Something went wrong with that request. Please try again.