Subject: | Periodic Timer stopping some code is blocking longer than the interval |
Hi,
The periodic timer isnt working anymore, if some code is taking longer than the interval of the timer
But it is still reporting that it is running
Glib::Timeout->add() works as expected and doesnt stop
The other loops (Polll and Select) are also working
see attachment for an example
perl -v:
This is perl, v5.10.1 (*) built for i486-linux-thread-multi
uname -a:
Linux delltop 2.6.31.5-mine #1 SMP PREEMPT Tue Nov 3 12:24:17 CET 2009 i686 Intel(R) Core(TM)2 Duo CPU T7500 @ 2.20GHz GenuineIntel GNU/Linux
The periodic timer isnt working anymore, if some code is taking longer than the interval of the timer
But it is still reporting that it is running
Glib::Timeout->add() works as expected and doesnt stop
The other loops (Polll and Select) are also working
see attachment for an example
perl -v:
This is perl, v5.10.1 (*) built for i486-linux-thread-multi
uname -a:
Linux delltop 2.6.31.5-mine #1 SMP PREEMPT Tue Nov 3 12:24:17 CET 2009 i686 Intel(R) Core(TM)2 Duo CPU T7500 @ 2.20GHz GenuineIntel GNU/Linux
Subject: | glib-periodic.pl |
#!/usr/bin/perl -w
use IO::Async::Loop::Glib;
use IO::Async::Timer::Periodic;
use IO::Async::Timer::Countdown;
my $loop = IO::Async::Loop::Glib->new;
my $countdown = IO::Async::Timer::Countdown->new(
delay => 3,
on_expire => sub {
print "some code which is taking longer than the interval\n";
sleep 2;
}
);
$loop->add($countdown);
$countdown->start;
# stops if $countdown on_expire is executed
my $periodic = IO::Async::Timer::Periodic->new(
interval => 1,
on_tick => sub {
print "io-async-timer-periodic: on_tick\n";
return 1;
}
);
$loop->add($periodic);
$periodic->start;
# this works as expected
Glib::Timeout->add(1000, sub {
print "glib-timeout: on_tick\n";
print "periodic still running? ", $periodic->is_running, "\n";
return 1;
});
$loop->loop_forever;