Skip to content

Instantly share code, notes, and snippets.

@mshock
Created May 15, 2012 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mshock/2703298 to your computer and use it in GitHub Desktop.
Save mshock/2703298 to your computer and use it in GitHub Desktop.
alarm scheduling framework
#! /usr/bin/perl
$SIG{ALRM} = \&ten_min_task;
alarm (600);
while (1) {
# run in between task here
#sleep 1; print "foo\n";
}
# asynchronous interrupt task
sub ten_min_task {
alarm 600;
# run this code every 10 minutes
#print "bar\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment