delorie.com/djgpp/doc/libc/libc_43.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

alarm

Syntax

 
#include <unistd.h>

unsigned alarm(unsigned seconds);

Description

This function causes the signal SIGALRM to be raised in seconds seconds. A value of zero for seconds cancels any pending alarm. If an alarm has previously been set, the new alarm delay will supercede the prior call.

Note that signals in DJGPP are deferred when the program is inside a real-mode (e.g., DOS) call or isn't touching its data; see signal, for more details.

A misfeature of Windows 9X prevents the timer tick interrupt from being delivered to programs that are in the background (i.e. don't have the focus), even though the program itself might continue to run, if you uncheck the Background: Always suspend property in the Property Sheets. Therefore, alarm will not work in background programs on Windows 9X.

Return Value

The number of seconds remaining on the timer (i.e. always seconds).

Portability

ANSI/ISO C No
POSIX 1003.2-1992; 1003.1-2001

Example

 
signal(SIGALRM,my_alarm_routine);
alarm(5);


  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004