SPUG: Need an asynchronous alarm handler

ced at carios2.ca.boeing.com ced at carios2.ca.boeing.com
Fri May 25 13:13:32 CDT 2001


>I see that there's an alarm function in the built-in library, but how do you
>setup a callback function to be called when a SIGALARM is generated?

>Basically, I'm looking for a snippet to show me how to set up async alarm
>handling.

perldoc perlipc

Here's a bit from the perlipc:

eval {
             local $SIG{ALRM} = sub { die "alarm clock restart" };
             alarm 10;
             flock(FH, 2);   # blocking write lock
             alarm 0;
     };
     if ($@ and $@ !~ /alarm clock restart/) { die }


Rgds,
--
Charles DeRykus


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/





More information about the spug-list mailing list