Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Event and max_cb_tm,

1 view
Skip to first unread message

Dariush Pietrzak

unread,
Feb 1, 2005, 7:17:04 AM2/1/05
to perl...@perl.org
Hello,
when I played with Event some time ago it used to put
timer on all callbacks, thus something like this:

Event->timer(interval=>5,cb=>sub {sleep 999999;},);

didn't stop application from running.
Now i've written a small app using Event, deployed it, and painfully
realised that single hanged event stopped it from running.
Is my memory failing me, have Event ever had this property of time-outing
long running callbacks?
I found max_cb_tm in docs, but it doesent work:
Event->timer(interval=>5,max_cb_tm=>1,cb=>sub {sleep 999999;},);
and grep max_cb_tm Event.pm reveals nothing.

How should time limit on callbacks be implemented? Do I have to implement
it inside every cb?

regards,
--
Dariush Pietrzak,
Key fingerprint = 40D0 9FFB 9939 7320 8294 05E0 BCC7 02C4 75CC 50D9

Joshua N Pritikin

unread,
Feb 1, 2005, 8:21:16 AM2/1/05
to perl...@perl.org
On Tue, 2005-02-01 at 13:17 +0100, Dariush Pietrzak wrote:
> Is my memory failing me, have Event ever had this property of time-outing
> long running callbacks?

Not by default.

> I found max_cb_tm in docs, but it doesent work:
> Event->timer(interval=>5,max_cb_tm=>1,cb=>sub {sleep 999999;},);
> and grep max_cb_tm Event.pm reveals nothing.

Hrm, did you try Event::Stats? Just read the doc:

=item max_cb_tm => $seconds

The maximum number of seconds to spend in a callback. If a callback
uses more time then it is aborted. Defaults to 1 sec. This feature
is normally disabled. See Event::Stats.


signature.asc
0 new messages