Controlling (and skipping) 'stacked' events
[email protected] (Jeff Boes) 19 Aug 2002 11:57:09 -0400
| Newsgroups | perl.loop |
|---|---|
| Message-ID | <[email protected]> |
I remain confused about a technique that I'm sure is available in Event,
but I can't puzzle it out.
Say I have two events, both 'timer' type. One event is a 'heartbeat'
report to another process, saying "I'm still alive, and I processed N
requests since the last time I talked to you." The other event is (as
you might guess), "process some number of things".
My problem is that sometimes the second event takes a pretty long time,
so long that the first event's scheduled time to run elapses, then
elapses again, and sometimes even a third time. As a result, I get
reports from this event that look like--
10:12:42.055 Did 97 things
10:12:42.059 Did 0 things
10:12:42.063 Did 0 things
How does an event handler recognize when it has more than one pending
event? (Probably using $watcher->pending, if I read the perldoc
correctly.) And how can it (the event handler) unqueue the pending
events for itself? Just "$watcher->stop and $watcher->start"? Does
this have side effects that I need to check for?
--
Jeff Boes vox 269.226.9550 ext 24
Database Engineer fax 269.349.9076
Nexcerpt, Inc. http://www.nexcerpt.com
...Nexcerpt... Extend your Expertise