< Perl Programming < Keywords
The alarm keyword
alarm delivers a SIGALRM to this process after SECONDS wallclock seconds have passed. If SECONDS is omitted, contents of $_ are used. Some machines, however, may divert from the wallclock seconds by ±1 s.
This call starts one and only one timer; each new call disables the previous timer like a call with 0 would also do. From Perl 5.8.0 on, the timer with a better granularity is supplied by ualarm().
Instead of using alarm, it is possible to use Perl's four-argument version of select() with the first three arguments undefined. Another way is to use syscall() to access setitimer(2)(), if supported.
Beware of intermixing alarm and sleep calls, as sleep may be internally implemented on the system with alarmǃ
Syntax
alarm SECONDS
alarm
Examples
alarm 4;
See also
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.