September 2000
Intermediate to advanced
624 pages
14h 32m
English
The alarm(3) function is related to signals. It is useful as a simple timer and is used for signal demonstrations in this chapter. The function synopsis is as follows:
#include <unistd.h> unsigned int alarm(unsigned int seconds);
The alarm(3) function returns the previous alarm setting in seconds and establishes a new timer if the argument seconds is greater than zero. After the call is made and the specified time elapses, the signal SIGALRM is raised. This signal indicates the expiration of the timer. If alarm(3) is called before SIGALRM is raised, the current timer is canceled and a new timer is started. Specifying a value of zero to alarm(3) cancels the timer in progress without starting a new one.
Note
There ...
Read now
Unlock full access