in reply to Re: Inexplicable ECHILD
in thread Inexplicable ECHILD
No. The OP is checking $! very soon (in time) after a failing system call (select inside can_read() from IO::Select). The signal handler adds a race condition that has little to do with checking $! at the wrong time.
Granted, there is a small chance that $select->count() might (indirectly) trigger the setting of $! or that can_read() could return an empty list w/o select having failed, but the source of the former risk is actually what avoids the latter risk (and the former risk seems slight).
The code could certainly be clearer on what was expected to have set $!. Saving off with something like $err= $!; immediately after the failure would add clarity. But it wouldn't eliminate the race condition and so wouldn't really fix the actual problem described.
- tye
|
|---|