[ale] SIGALRM
Dan Newcombe
newcombe at aa.csc.peachnet.edu
Thu Jul 11 12:53:08 EDT 1996
> Why would a program catch signal 14 (SIGALRM)?
They are quite the collectors item. It fact, in SIGALRM issue number
2, we learn that Superman was actually...well, never mind.
Alarm is similar to sleep. Sleep puts the process to sleep for a
certain amount of time. While the timer counts down, the process can't
do anything.
With Alarm, the process continues to run, and the timer counts down "in
the background". When the timer hits zero the system sends an SIGALRM
to the process telling it the timer was done, and the process can then
react.
An example:
A process is expecting to read data from a (pipe|socket|device)
within a certain amount of time. If the process slept for that time,
it may miss some info. By setting the alarm, the process can read
whatever comes across while waiting for the alarm. When the alarm
happens, the process then knows that time is up, and should stop
waiting for data (ie. it timed-out)
Hope this helps.
-Dan
--
Dan Newcombe - Clayton State College - User Services - 770-961-3421
newcombe at aa.csc.peachnet.edu http://www.csc.peachnet.edu/home/dan/
- Fearlessly the idiot faced the crowd - smiling.
Pink Floyd, Fearless
More information about the Ale
mailing list