alarm()

generate a SIGALRM signal after specified time period 

Function


SYNOPSIS

#include <unistd.h>

unsigned int alarm(unsigned int seconds);


DESCRIPTION

The alarm() function causes the system to generate a SIGALRM signal after the number of real-time seconds (specified by seconds) has elapsed. Processor scheduling delays may prevent the process from handling the signal as soon as it is generated.

Alarm requests are not stacked; only one SIGALRM generation can be scheduled in this way. Successive calls reset the alarm clock of the calling process.

If seconds is zero, any previously made alarm request is cancelled. fork() sets the alarm clock of a new process to zero. The exec() family of routines creates a process that inherits the time left on the old process's alarm clock.


PARAMETERS

seconds 

Specifies the number of real-time (as opposed to CPU-time) seconds that must elapse before the system sends the calling process a SIGALRM signal. If this parameter is 0, any pending alarm request is cancelled.


RETURN VALUES

If there is a previous alarm() request with time remaining, alarm() returns a non-zero value that is the number of seconds until the previous request would have generated a SIGALRM signal. Otherwise, alarm() returns 0.


CONFORMANCE

POSIX.1 (1996).


MULTITHREAD SAFETY LEVEL

Async-signal-safe.


PORTING ISSUES

alarm() is implemented in terms of setitimer().


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
execl(), execle(), execlp(), execlpe(), execv(), execve(), execvp(), execvpe(), nanosleep(), nap(), pause(), setitimer(), sigaction(), signal(), sleep(), ualarm()


PTC MKS Toolkit 10.5 Documentation Build 40.