~ubuntu-branches/ubuntu/hardy/apache2/hardy-proposed

« back to all changes in this revision

Viewing changes to os/win32/util_win32.c

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Fritsch
  • Date: 2008-01-17 20:27:56 UTC
  • mto: This revision was merged to the branch mainline in revision 26.
  • Revision ID: james.westby@ubuntu.com-20080117202756-hv38rjknhwa2ilwi
Tags: upstream-2.2.8
ImportĀ upstreamĀ versionĀ 2.2.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
145
145
        LocalFree(sa);
146
146
    }
147
147
}
148
 
 
149
 
 
150
 
/*
151
 
 * The Win32 call WaitForMultipleObjects will only allow you to wait for
152
 
 * a maximum of MAXIMUM_WAIT_OBJECTS (current 64).  Since the threading
153
 
 * model in the multithreaded version of apache wants to use this call,
154
 
 * we are restricted to a maximum of 64 threads.  This is a simplistic
155
 
 * routine that will increase this size.
156
 
 */
157
 
DWORD wait_for_many_objects(DWORD nCount, CONST HANDLE *lpHandles,
158
 
                            DWORD dwSeconds)
159
 
{
160
 
    time_t tStopTime;
161
 
    DWORD dwRet = WAIT_TIMEOUT;
162
 
    DWORD dwIndex=0;
163
 
    BOOL bFirst = TRUE;
164
 
 
165
 
    tStopTime = time(NULL) + dwSeconds;
166
 
 
167
 
    do {
168
 
        if (!bFirst)
169
 
            Sleep(1000);
170
 
        else
171
 
            bFirst = FALSE;
172
 
 
173
 
        for (dwIndex = 0; dwIndex * MAXIMUM_WAIT_OBJECTS < nCount; dwIndex++) {
174
 
            dwRet = WaitForMultipleObjects(
175
 
                min(MAXIMUM_WAIT_OBJECTS, nCount - (dwIndex * MAXIMUM_WAIT_OBJECTS)),
176
 
                lpHandles + (dwIndex * MAXIMUM_WAIT_OBJECTS),
177
 
                0, 0);
178
 
 
179
 
            if (dwRet != WAIT_TIMEOUT) {
180
 
              break;
181
 
            }
182
 
        }
183
 
    } while((time(NULL) < tStopTime) && (dwRet == WAIT_TIMEOUT));
184
 
 
185
 
    return dwRet;
186
 
}