## From win32.c
if (mode == P_NOWAIT) {
/* asynchronous spawn -- store handle, return PID */
ret = (int)ProcessInformation.dwProcessId;
if (IsWin95() && ret < 0)
ret = -ret;
w32_child_handles[w32_num_children] = ProcessInformation.hProcess;
w32_child_pids[w32_num_children] = (DWORD)ret;
++w32_num_children;
}
####
case P_NOWAIT: /* asynch + remember result */
if (w32_num_children >= MAXIMUM_WAIT_OBJECTS) {
errno = EAGAIN;
ret = -1;
goto RETVAL;
}
##
##
C:\test>perl -le "for (1..100) {Win32::Spawn( $ENV{ComSpec},'/c echo>null', $pid );print qq[$_\tpid:$pid\t],$?==-1 ? $! : 'OK' };"
1 pid:5492 OK
2 pid:5256 OK
3 pid:1860 OK
...
93 pid:2236 OK
94 pid:2308 OK
95 pid:4012 OK
96 pid:4796 OK
97 pid:4636 OK
98 pid:4780 OK
99 pid:244 OK
100 pid:4800 OK