2008-08-22 Pascal Obry <obry@adacore.com>
* adaint.c: Fix possible race condition on win32_wait().
From-SVN: r139466
DWORD res;
int k;
Process_List *pl;
+ int hl_len;
if (plist_length == 0)
{
return -1;
}
- hl = (HANDLE *) xmalloc (sizeof (HANDLE) * plist_length);
-
k = 0;
plist_enter();
+ hl_len = plist_length;
+
/* -------------------- critical section -------------------- */
+ hl = (HANDLE *) xmalloc (sizeof (HANDLE) * hl_len);
+
pl = PLIST;
while (pl)
{
plist_leave();
- res = WaitForMultipleObjects (plist_length, hl, FALSE, INFINITE);
+ res = WaitForMultipleObjects (hl_len, hl, FALSE, INFINITE);
h = hl[res - WAIT_OBJECT_0];
free (hl);