]> granicus.if.org Git - apache/commitdiff
poll+accept without accept serialziation is dangerous, so for the
authorManoj Kasichainula <manoj@apache.org>
Fri, 16 Jul 1999 00:24:04 +0000 (00:24 +0000)
committerManoj Kasichainula <manoj@apache.org>
Fri, 16 Jul 1999 00:24:04 +0000 (00:24 +0000)
moment, keep serialization on all the time and get rid of the attempts
to make its usage thread-safe.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@83458 13f79535-47bb-0310-9956-ffa450edef68

server/mpm/mpmt_pthread/mpmt_pthread.c

index a6ab8b95dca0b9258e17b07857f888651edc1e0d..6d32d19a3825ad21e9d4091e6a8bf456848231f8 100644 (file)
@@ -91,8 +91,7 @@ API_VAR_EXPORT int ap_extended_status = 0;
 static int workers_may_exit = 0;
 static int requests_this_child;
 static int num_listenfds = 0;
-static struct pollfd *listenfds_child; /* The listenfds that each thread copies
-                                          for itself */
+static struct pollfd *listenfds;
 
 /* The structure used to pass unique initialization info to each thread */
 typedef struct {
@@ -102,7 +101,7 @@ typedef struct {
     pool *tpool; /* "pthread" would be confusing */
 } proc_info;
 
-#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT
+#if 0
 #define SAFE_ACCEPT(stmt) do {if (ap_listeners->next != NULL) {stmt;}} while (0)
 #else
 #define SAFE_ACCEPT(stmt) do {stmt;} while (0)
@@ -867,7 +866,6 @@ static void * worker_thread(void * dummy)
     char pipe_read_char;
     int curr_pollfd, last_pollfd = 0;
     size_t len = sizeof(struct sockaddr);
-    struct pollfd *listenfds;
 
     free(ti);
 
@@ -879,9 +877,6 @@ static void * worker_thread(void * dummy)
 
     /* TODO: Switch to a system where threads reuse the results from earlier
        poll calls - manoj */
-    /* set up each thread's individual pollfd array */
-    listenfds = ap_palloc(tpool, sizeof(struct pollfd) * (num_listenfds + 1));
-    memcpy(listenfds, listenfds_child, sizeof(struct pollfd) * (num_listenfds + 1));
     while (!workers_may_exit) {
         workers_may_exit |= (ap_max_requests_per_child != 0) && (requests_this_child <= 0);
         if (workers_may_exit) break;
@@ -1017,14 +1012,14 @@ static void child_main(int child_num_arg)
     requests_this_child = ap_max_requests_per_child;
     
     /* Set up the pollfd array */
-    listenfds_child = ap_palloc(pchild, sizeof(struct pollfd) * (num_listenfds + 1));
-    listenfds_child[0].fd = pipe_of_death[0];
-    listenfds_child[0].events = POLLIN;
-    listenfds_child[0].revents = 0;
+    listenfds = ap_palloc(pchild, sizeof(struct pollfd) * (num_listenfds + 1));
+    listenfds[0].fd = pipe_of_death[0];
+    listenfds[0].events = POLLIN;
+    listenfds[0].revents = 0;
     for (lr = ap_listeners, i = 1; i <= num_listenfds; lr = lr->next, ++i) {
-        listenfds_child[i].fd = lr->fd;
-        listenfds_child[i].events = POLLIN; /* should we add POLLPRI ?*/
-        listenfds_child[i].revents = 0;
+        listenfds[i].fd = lr->fd;
+        listenfds[i].events = POLLIN; /* should we add POLLPRI ?*/
+        listenfds[i].revents = 0;
     }
 
     /* Setup worker threads */