Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

gettimer(3)

alarm(3)  —  Subroutines

OSF

NAME

alarm, ualarm − Sets or changes the timeout of interval timers

LIBRARY

Standard C Library (libc.a)

SYNOPSIS

#include <sys/unistd.h>

unsigned int alarm(
    unsigned int seconds) ;

unsigned int ualarm(
    unsigned int mseconds,
    unsigned int interval) ;

PARAMETERS

secondsSpecifies a number of real-time seconds. 

msecondsSpecifies a number of real-time microseconds. 

intervalSpecifies the interval for repeating the timer. 

DESCRIPTION

The alarm() function is used to obtain notification of a timeout after the number of real-time seconds specified by the seconds parameter has elapsed.  At some time after seconds seconds have elapsed, a signal is delivered to the process.  Each call resets the timer until the seconds parameter is set to 0 (zero). When the notification signal is caught or ignored, no action takes place; otherwise the calling process is terminated.  The alarm() function uses the ITIMER_REAL interval timer. 

The ualarm() function is used to obtain notification of a timeout after the number of real-time microseconds specified by the mseconds parameter has elapsed.  When the interval parameter is nonzero, timeout notification occurs after the number of microseconds specified by the interval parameter has been added to the mseconds parameter.  When the notification signal is caught or ingnored, no action takes place; otherwise the calling process is terminated.  The ualarm() function is the simplified interface to the setitimer() function, and uses the ITIMER_REAL interval timer. 

NOTES

The alarm() function is supported for multi-threaded applications.  The ualarm() function is not supported for multiple threads. 

Although the alarm() function itself is reentrant, it should be noted that just as the second of two calls from a single thread to alarm() resets the timer, this is also true if two calls are made from different threads. 

AES Support Level:
Full use

RETURN VALUES

Upon successful completion, the value 0 (zero) is returned.  Otherwise, -1 is returned and errno is set to indicate the error. 

ERRORS

If the alarm() function fails, errno may be set to the following value:

[EINVAL]The seconds parameter specifies a negative value or a value greater than 100,000,000. 

RELATED INFORMATION

Functions: gettimer(3)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026