in reply to Unix Review column
in thread wait problem for WIN32 perl
The negative pids aren't produced by win2k, but by Perl's fork emulation on win32 which uses -$tid as the (pseudo-) process id.
This behaviour is documented in perlfork and if you page down to the bugs section, you'll see that the problem you encountered with wait is obliquely described there.
It makes the correct way to wait for all subprocesses to terminate:
1 while wait() != -1;
This relies on the fact that the first thread of a process is 1, which means that no forked pseudo-process will have pid of -1 and should therefore work cross-platform.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Unix Review column
by merlyn (Sage) on May 20, 2005 at 17:55 UTC | |
by BrowserUk (Patriarch) on May 20, 2005 at 18:31 UTC |