Index: src/backend/postmaster/postmaster.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/postmaster/postmaster.c,v retrieving revision 1.421 diff -c -w -r1.421 postmaster.c *** src/backend/postmaster/postmaster.c 8 Aug 2004 20:17:34 -0000 1.421 --- src/backend/postmaster/postmaster.c 26 Aug 2004 04:04:20 -0000 *************** *** 3736,3746 **** static pid_t win32_waitpid(int *exitstatus) { - Assert(win32_childPIDArray && win32_childHNDArray); - elog(DEBUG3, "waiting on %lu children", win32_numChildren); - - if (win32_numChildren > 0) - { /* * Note: Do NOT use WaitForMultipleObjectsEx, as we don't want to * run queued APCs here. --- 3736,3741 ---- *************** *** 3748,3775 **** int index; DWORD exitCode; DWORD ret; ! ret = WaitForMultipleObjects(win32_numChildren, win32_childHNDArray, ! FALSE, 0); switch (ret) { case WAIT_FAILED: ereport(LOG, ! (errmsg_internal("failed to wait on %lu children: %d", ! win32_numChildren, (int) GetLastError()))); return -1; case WAIT_TIMEOUT: ! /* No children have finished */ ! return -1; default: - /* * Get the exit code, and return the PID of, the * respective process */ ! index = ret - WAIT_OBJECT_0; Assert(index >= 0 && index < win32_numChildren); if (!GetExitCodeProcess(win32_childHNDArray[index], &exitCode)) { --- 3743,3775 ---- int index; DWORD exitCode; DWORD ret; + unsigned long offset; + + Assert(win32_childPIDArray && win32_childHNDArray); + elog(DEBUG3, "waiting on %lu children", win32_numChildren); ! for (offset = 0; offset < win32_numChildren; offset += MAXIMUM_WAIT_OBJECTS) ! { ! unsigned long num = min(MAXIMUM_WAIT_OBJECTS, win32_numChildren - offset); ! ret = WaitForMultipleObjects(num, &win32_childHNDArray[offset], FALSE, 0); switch (ret) { case WAIT_FAILED: ereport(LOG, ! (errmsg_internal("failed to wait on %lu of %lu children: %d", ! num, win32_numChildren, (int) GetLastError()))); return -1; case WAIT_TIMEOUT: ! /* No children (in this chunk) have finished */ ! break; default: /* * Get the exit code, and return the PID of, the * respective process */ ! index = offset + ret - WAIT_OBJECT_0; Assert(index >= 0 && index < win32_numChildren); if (!GetExitCodeProcess(win32_childHNDArray[index], &exitCode)) { *************** *** 3787,3793 **** } } ! /* No children */ return -1; } --- 3787,3793 ---- } } ! /* No children have finished */ return -1; }