Do you think there's some simple way of translating this:
Event->idle(min=>$mint,max=>$maxt,
cb=> [$sth,"method"],
max_cb_tm=>$timeout,);
into POE? Or would I have to scrap all the code I have written so far and start from the beggining?
Also, the problem is not exactly with processes being slow, but with multiplying timeouts.
Look:
sub vicous {
#....
for (0..int(rand(1000))) {
sleep(int(rand(10)));# this takes at most 10s
};
#...
}
All this code is wrapped in single timeout, ie
alarm(10000);
vicious();
alarm(0);
Above written as example, not actual code, because as I said, I'm using
Event and not the actual alarms, but, what I'm trying to do is:
sub vicious {
#...
for (0..int(rand(1000))) {
sleep(int(rand(10)));
#....
alarm(0);#reset alarm, we're OK
alarm(10);#reset alarm..
};
#...
alarm(10);
vicious();
alarm(0);
This theoretically would result in every 'task' operation being kept under 10s.