Event->idle(min=>$mint,max=>$maxt, cb=> [$sth,"method"], max_cb_tm=>$timeout,); #### sub vicous { #.... for (0..int(rand(1000))) { sleep(int(rand(10)));# this takes at most 10s }; #... } #### alarm(10000); vicious(); alarm(0); #### 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);