alarm

Sends the signal SIGALRM (defined in the <signal.h> header file) to the invoking process after the number of seconds indicated by its argument has elapsed.

Format

#include  <unistd.h>

unsigned int alarm  (unsigned int seconds); (ISO POSIX-1)

int alarm  (unsigned int seconds); (Compatability)

Argument

seconds
Has a maximum limit of LONG_MAX seconds.

Description

Calling the alarm function with a 0 argument cancels any pending alarms.

Unless it is caught or ignored, the signal generated by alarm terminates the process. Successive alarm calls reinitialize the alarm clock. Alarms are not stacked.

Because the clock has a 1-second resolution, the signal may occur up to 1 second early. If the SIGALRM signal is caught, resumption of execution may be held up due to scheduling delays.

When the SIGALRM signal is generated, a call to SYS$WAKE is generated whether or not the process is hibernating. The pending wake causes the current pause() to return immediately (after completing any function that catches the SIGALRM).

Return Value
The number of seconds remaining from a previous alarm request. 


Previous Page | Next Page | Table of Contents | Index