COHERENT manpages

This page displays the COHERENT manpage for alarm() [Set a timer].

List of available manpages
Index


alarm() -- System Call (libc)

Set a timer
#include <unistd.h>
alarm(seconds)
unsigned seconds;

alarm()  sets a  timer.  After  seconds, the  COHERENT kernel  sends signal
SIGALRM to the process that  invoked alarm(). Setting seconds to zero turns
off the alarm timer.

By default, signal SIGALRM  terminates the process.  However, a program can
invoke  the  system call  signal()  to  catch this  signal,  or ignore  it.
Because of scheduling  variation and the one-second granularity, the action
of alarm() is predictable only to within one second.

alarm() is useful for such things as timeouts.  For example, a process on a
dial-in port  might hang up  the line after  a sufficient time  has elapsed
with no user response.

alarm()  returns  the  previous  alarm  value,  which represents  the  time
remaining from the previous call.   Time remaining is superseded by the new
alarm value.

See Also

libc,
signal(),
sleep(),
unistd.h
POSIX Standard, §3.4.1

Notes

A process can set only one alarm at a time.