On Mon, Aug 19, 2002 at 11:57:09AM -0400, Jeff Boes wrote: > 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?
It depends on the watcher type. Sometimes the information is in $event->hits. Sometimes you actually get multiple events queued for a given watcher. > (Probably using $watcher->pending, if I read the perldoc > correctly.) And how can it (the event handler) unqueue the pending > events for itself? That's not implemented. Do you really need to do that?? > Just "$watcher->stop and $watcher->start"? Does > this have side effects that I need to check for? No, that won't work. Any queued events will be serviced even if the watcher is stopped. The stopped state means that no futher events will be queued. -- Victory to the Divine Mother!! after all, http://sahajayoga.org http://why-compete.org
