in reply to Threads and ALARM() - There is a solution or workaround?
Alarm uses signals. Signals are sent to processes, not threads. Also, it means you can only have one alarm in effect at a time. If you want to use alarm, you can't use threads.
In your case, when one thread exits, it resets the signal handler for everyone, making the alarm fatal. Your shell reports that your program died from the alarm signal by printing "Alarm clock".
$ perl -e'alarm(1); sleep' Alarm clock
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Threads and ALARM() - There is a solution or workaround?
by perlmonks12 (Novice) on May 10, 2010 at 17:11 UTC | |
by ikegami (Patriarch) on May 10, 2010 at 17:20 UTC |