You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by mt...@apache.org on 2006/08/02 17:31:25 UTC

svn commit: r428029 - in /httpd/httpd/trunk: CHANGES os/win32/util_win32.c server/mpm/winnt/child.c

Author: mturk
Date: Wed Aug  2 08:31:24 2006
New Revision: 428029

URL: http://svn.apache.org/viewvc?rev=428029&view=rev
Log:
Fix return values from wait_for_many_objects.
The return value is index to the signaled thread in
the creted_threads array.
We can not use WAIT_TIMEOUT as return value
because its value is defined as 258, thus limiting
the MaxThreads to that value that leads to the
assertion errors.

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/os/win32/util_win32.c
    httpd/httpd/trunk/server/mpm/winnt/child.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=428029&r1=428028&r2=428029&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Wed Aug  2 08:31:24 2006
@@ -2,6 +2,12 @@
 Changes with Apache 2.3.0
   [Remove entries to the current 2.0 and 2.2 section below, when backported]
 
+  *) mpm_winnt: Fix return values from wait_for_many_objects.
+     The return value is index to the signaled thread in the
+     creted_threads array. We can not use WAIT_TIMEOUT because
+     his value is defined as 258, thus limiting the MaxThreads
+     to that value. [Mladen Turk]
+
   *) mod_proxy_balancer: Workers can now be defined as part of
      a balancer cluster "set" in which members of a lower-numbered set
      are preferred over higher numbered ones. [Jim Jagielski]

Modified: httpd/httpd/trunk/os/win32/util_win32.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/os/win32/util_win32.c?rev=428029&r1=428028&r2=428029&view=diff
==============================================================================
--- httpd/httpd/trunk/os/win32/util_win32.c (original)
+++ httpd/httpd/trunk/os/win32/util_win32.c Wed Aug  2 08:31:24 2006
@@ -158,7 +158,7 @@
                             DWORD dwSeconds)
 {
     time_t tStopTime;
-    DWORD dwRet = WAIT_TIMEOUT;
+    DWORD dwRet = WAIT_FAILED;
     DWORD dwIndex=0;
     BOOL bFirst = TRUE;
 
@@ -175,12 +175,20 @@
                 min(MAXIMUM_WAIT_OBJECTS, nCount - (dwIndex * MAXIMUM_WAIT_OBJECTS)),
                 lpHandles + (dwIndex * MAXIMUM_WAIT_OBJECTS),
                 0, 0);
-
+            if (dwRet == WAIT_FAILED) {
+                return dwRet;
+            }
             if (dwRet != WAIT_TIMEOUT) {
-              break;
+                if (dwRet >= WAIT_ABANDONED_0)
+                    dwRet = dwRet - WAIT_ABANDONED_0;
+                else
+                    dwRet = dwRet - WAIT_OBJECT_0;
+                dwRet = dwRet + (dwIndex * MAXIMUM_WAIT_OBJECTS);
+                break;
             }
+            dwRet = WAIT_FAILED;
         }
-    } while((time(NULL) < tStopTime) && (dwRet == WAIT_TIMEOUT));
+    } while((time(NULL) < tStopTime) && (dwRet == WAIT_FAILED));
 
     return dwRet;
 }

Modified: httpd/httpd/trunk/server/mpm/winnt/child.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/winnt/child.c?rev=428029&r1=428028&r2=428029&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/winnt/child.c (original)
+++ httpd/httpd/trunk/server/mpm/winnt/child.c Wed Aug  2 08:31:24 2006
@@ -1119,8 +1119,7 @@
     end_time = time(NULL) + 180;
     while (threads_created) {
         rv = wait_for_many_objects(threads_created, child_handles, (DWORD)(end_time - time(NULL)));
-        if (rv != WAIT_TIMEOUT) {
-            rv = rv - WAIT_OBJECT_0;
+        if (rv != WAIT_FAILED) {
             ap_assert((rv >= 0) && (rv < threads_created));
             cleanup_thread(child_handles, &threads_created, rv);
             continue;