]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
There -was- no race on Win32 in httpd-2.0, because the child thread
authorWilliam A. Rowe Jr <wrowe@apache.org>
Sun, 13 Feb 2005 22:10:02 +0000 (22:10 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Sun, 13 Feb 2005 22:10:02 +0000 (22:10 +0000)
  start function arg was redefined to be racy on httpd-2.1 (now fixed.)

  However, things aren't always clear when one goes nuts with casts,
  in fact they mask the real behavior.  So taking FirstBill's +1, clean
  up these ugly casts as we did in httpd-2.1 and make the code and it's
  behavior a little more self-evident.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.0.x@153678 13f79535-47bb-0310-9956-ffa450edef68

STATUS
server/mpm/winnt/child.c

diff --git a/STATUS b/STATUS
index 8d78c77ffe98c95049f60916797fc28b1ac81698..f07425c80709ac5d5b60f20689c1a2514eca80e8 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -112,15 +112,6 @@ PATCHES TO BACKPORT FROM TRUNK:
        svn rev 124104
        +1: minfrin
 
-    *) Win32: Eliminate a very ugly race - the parallel starting 
-       threads were picking up thread identifiers other than their
-       own.  Because the limit of threads is an int, stuffing the 
-       int into the void* value is a safe argument convention.
-
-       http://svn.apache.org/viewcvs.cgi?rev=123899&view=rev
-
-       +1: stoddard
-
     *) util_ldap: Add the directive LDAPConnectionTimeout to control
        the socket timeout value when binding to an LDAP server
        svn rev 126565
index a20d740743ec09f12a50e775726229088ff733eb..96150f5c5fb63606165881dbd5d643ab7b79b3ac 100644 (file)
@@ -321,7 +321,7 @@ static int remove_job(void)
 }
 
 
-static void win9x_accept(void * dummy)
+static unsigned int __stdcall win9x_accept(void * dummy)
 {
     struct timeval tv;
     fd_set main_fds;
@@ -405,6 +405,7 @@ static void win9x_accept(void * dummy)
        }
     }
     SetEvent(exit_event);
+    return 0;
 }
 
 
@@ -476,7 +477,7 @@ static PCOMP_CONTEXT win9x_get_connection(PCOMP_CONTEXT context)
  *    connections to service.
  */
 #define MAX_ACCEPTEX_ERR_COUNT 250
-static void winnt_accept(void *lr_) 
+static unsigned int __stdcall winnt_accept(void *lr_) 
 {
     ap_listen_rec *lr = (ap_listen_rec *)lr_;
     apr_os_sock_info_t sockinfo;
@@ -634,6 +635,7 @@ static void winnt_accept(void *lr_)
     }
     ap_log_error(APLOG_MARK, APLOG_INFO, APR_SUCCESS, ap_server_conf,
                  "Child %d: Accept thread exiting.", my_pid);
+    return 0;
 }
 
 
@@ -685,10 +687,11 @@ static PCOMP_CONTEXT winnt_get_connection(PCOMP_CONTEXT context)
  * Main entry point for the worker threads. Worker threads block in 
  * win*_get_connection() awaiting a connection to service.
  */
-static void worker_main(long thread_num)
+static unsigned int __stdcall worker_main(void *thread_num_val)
 {
     static int requests_this_child = 0;
     PCOMP_CONTEXT context = NULL;
+    int thread_num = (int)thread_num_val;
     ap_sb_handle_t *sbh;
 
     ap_log_error(APLOG_MARK, APLOG_DEBUG, APR_SUCCESS, ap_server_conf,
@@ -754,6 +757,7 @@ static void worker_main(long thread_num)
 
     ap_log_error(APLOG_MARK, APLOG_DEBUG, APR_SUCCESS, ap_server_conf,
                  "Child %d: Worker thread %ld exiting.", my_pid, thread_num);
+    return 0;
 }
 
 
@@ -780,7 +784,7 @@ static void create_listener_thread()
     int tid;
     int num_listeners = 0;
     if (!use_acceptex) {
-        _beginthreadex(NULL, 0, (LPTHREAD_START_ROUTINE) win9x_accept,
+        _beginthreadex(NULL, 0, win9x_accept,
                        NULL, 0, &tid);
     } else {
         /* Start an accept thread per listener 
@@ -803,7 +807,7 @@ static void create_listener_thread()
         /* Now start a thread per listener */
         for (lr = ap_listeners; lr; lr = lr->next) {
             if (lr->sd != NULL) {
-                _beginthreadex(NULL, 1000, (LPTHREAD_START_ROUTINE) winnt_accept,
+                _beginthreadex(NULL, 1000, winnt_accept,
                                (void *) lr, 0, &tid);
             }
         }
@@ -895,7 +899,7 @@ void child_main(apr_pool_t *pconf)
                 continue;
             }
             ap_update_child_status_from_indexes(0, i, SERVER_STARTING, NULL);
-            child_handles[i] = (HANDLE) _beginthreadex(NULL, 0, (LPTHREAD_START_ROUTINE) worker_main,
+            child_handles[i] = (HANDLE) _beginthreadex(NULL, 0, worker_main,
                                                        (void *) i, 0, &tid);
             if (child_handles[i] == 0) {
                 ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), ap_server_conf,