Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: More than one alarm-call at a timeby bluto (Curate) |
on Jan 16, 2004 at 17:33 UTC ( [id://321843]=note: print w/replies, xml ) | Need Help?? |
You could write a wrapper that remembers the list of alarms that need to trigger and then just run alarm() on the one
that is the closest in the future. Something (untested)
like ...
Your alarm signal handler will have to reestablish the next alarm to run by calling this routine without arguments. Note: if this routine is being called when another alarm occurs, you are probably in trouble. Even if you put something like 'alarm(0)' at the beginning of the routine, you will probably miss alarms. For this reason and other strange issues related to signals (i.e. sporadic core dumps), if at all possible, you may want to consider redesigning this since you are pushing the limits on what alarms were intended for. bluto
In Section
Seekers of Perl Wisdom
|
|