Rev | Author | # | Line |
---|---|---|---|
1 | perry | 1 | ALARM |
2 | !!!ALARM | ||
2 | PerryLorier | 3 | |
1 | perry | 4 | ---- |
5 | !!NAME | ||
6 | |||
7 | |||
8 | alarm - set an alarm clock for delivery of a signal | ||
9 | !!SYNOPSIS | ||
10 | |||
11 | |||
2 | PerryLorier | 12 | #include <unistd.h> |
13 | __unsigned int alarm(unsigned int __ ''seconds''__); __ | ||
14 | |||
1 | perry | 15 | !!DESCRIPTION |
16 | |||
2 | PerryLorier | 17 | __alarm__ arranges for a [SIGALRM] signal to be delivered to the process in ''seconds'' seconds. |
1 | perry | 18 | |
2 | PerryLorier | 19 | If ''seconds'' is zero, no new __alarm__ is scheduled. |
1 | perry | 20 | |
2 | PerryLorier | 21 | In any event any previously set __alarm__ is cancelled. |
1 | perry | 22 | |
2 | PerryLorier | 23 | If you want to wait for a time without using sleep(3) or alarm(2), then you might want to try select(2) with all the fdset's set to 0. select(2) also lets you pause for a subsecond delay. |
1 | perry | 24 | |
2 | PerryLorier | 25 | Since a [SIGALRM] will interrupt a running syscall it's common to use alarm(2) to timeout syscalls that may take some time, for example connect(2). |
1 | perry | 26 | |
27 | !!RETURN VALUE | ||
28 | |||
2 | PerryLorier | 29 | __alarm__ returns the number of seconds remaining until any previously scheduled alarm was due to be delivered, or zero if there was no previously scheduled alarm. |
1 | perry | 30 | |
31 | !!NOTES | ||
32 | |||
2 | PerryLorier | 33 | alarm(2) and setitimer(2) share the same timer; calls to one will interfere with use of the other. |
1 | perry | 34 | |
2 | PerryLorier | 35 | sleep(3) may be implemented using [SIGALRM]; mixing calls to alarm(2) and sleep(3) is a bad idea. |
1 | perry | 36 | |
2 | PerryLorier | 37 | Scheduling delays can, as ever, cause the execution of the process to be delayed by an arbitrary amount of time. |
1 | perry | 38 | |
39 | !!CONFORMING TO | ||
40 | |||
41 | SVr4, SVID, POSIX, X/OPEN, BSD 4.3 | ||
42 | !!SEE ALSO | ||
43 | |||
2 | PerryLorier | 44 | setitimer(2), signal(2), sigaction(2), gettimeofday(2), select(2), pause(2), sleep(3), select(2) |
lib/blame.php:177: Warning: Invalid argument supplied for foreach() (...repeated 4 times)