SIGALRM is a unix signal that is triggered by alarm(2). Basically, a timer counts down specified amount of seconds; at some point when the timer reaches 0, SIGALRM is sent to the originating process.

Typically alarm is used as a time-out mechanism. For instance:

#!/usr/bin/perl

## setup the alarm handler
BEGIN { $SIG{ALRM} = sub { print "Alarm!!\n"; } }

## set the timer for 5 seconds
alarm 5;
## pretend we're doing something that involves blocking 
sleep (10);
## turn off the timer, but of course the previous line 
## will cause the alarm to go off.
alarm 0;

Log in or register to write something here or to contact authors.