[Israel.pm] $SIG{ALRM} and alarm.

Yuval Kogman nothingmuch at woobling.org
Thu May 31 15:34:46 EEST 2007


POE or another event loop.

Event loops keep track of the timers required and use low level
functions to set alarm() for the one that'll happen soonest,
installing the next timer as part of it's trigger before calling the
original handler. Managing low level resources like IO, timers, etc
in light of concurrent operations is a problem with many solutions.
Look on the CPAN for POE, Event, Danga::Socket, Event::Lib and
probably a few others. Of these POE is the most high level, and even
has some wrapper kernels to work with some of the others I
mentioned. POE is more about a style for developing event based
programs, and comes with lots of modular components that fit with
that style.

Good luck.

On Thu, May 31, 2007 at 11:54:18 +0300, Meron Cohen wrote:
> Hi all,
> 
> I'm trying to implement 2 timers in a script. One that timeouts the time
> that the script runs and another one that timeouts the time that a
> command that runs on a card (embedded system). Anyway, for timers I use
> the $SIG{ALRM} and alarm. The problem is that the command "alarm" knows
> how to wait for one timer only (the second alarm destroy the first
> alarm). Do you know I to solve that problem?
> 
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://perl.org.il/mailman/listinfo/perl

-- 
  Yuval Kogman <nothingmuch at woobling.org>
http://nothingmuch.woobling.org  0xEBD27418

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://perl.org.il/pipermail/perl/attachments/20070531/abe54b65/attachment.pgp 


More information about the Perl mailing list