in reply to limiting children
This ensures that your code will be calling the scheduler whenever there is something to do and/or a child terminates.
I agree, however, that it is probably cheaper to try to get a module that already does all this correctly, as my suggestion would be reinventing the wheel.
Now somebody that knows more about the Perl's internals than me, could clarify on the risk of getting your script to dump core. (Note that I have some code like this that does a few millions operations such as those a day and never had any occurrence).
The risk would come from the fact that the scheduler function would be performing list management on the arrival of a signal, which is an asynchronous event. The signal might arrive while the scheduler is manipulating the list of tasks when called by the event loop. In this case, a reentrant call to the scheduler would attempt to modify the list with a potentially inconsistent data structure.
In practice, however, you should not worry about this :)
Good luck.
|
|---|