1UALARM(3) Linux Programmer's Manual UALARM(3)
2
3
4
6 ualarm - schedule signal after given number of microseconds
7
9 #include <unistd.h>
10
11 useconds_t ualarm(useconds_t usecs, useconds_t interval);
12
13 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
14
15 ualarm():
16 Since glibc 2.12:
17 _BSD_SOURCE ||
18 (_XOPEN_SOURCE >= 500 ||
19 _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED) &&
20 !(_POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700)
21 Before glibc 2.12:
22 _BSD_SOURCE || _XOPEN_SOURCE >= 500 ||
23 _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
24
26 The ualarm() function causes the signal SIGALRM to be sent to the
27 invoking process after (not less than) usecs microseconds. The delay
28 may be lengthened slightly by any system activity or by the time spent
29 processing the call or by the granularity of system timers.
30
31 Unless caught or ignored, the SIGALRM signal will terminate the
32 process.
33
34 If the interval argument is nonzero, further SIGALRM signals will be
35 sent every interval microseconds after the first.
36
38 This function returns the number of microseconds remaining for any
39 alarm that was previously set, or 0 if no alarm was pending.
40
42 EINTR Interrupted by a signal.
43
44 EINVAL usecs or interval is not smaller than 1000000. (On systems
45 where that is considered an error.)
46
48 4.3BSD, POSIX.1-2001. POSIX.1-2001 marks ualarm() as obsolete.
49 POSIX.1-2008 removes the specification of ualarm(). 4.3BSD, SUSv2, and
50 POSIX do not define any errors.
51
53 POSIX.1-2001 does not specify what happens if the usecs argument is 0.
54 On Linux (and probably most other systems), the effect is to cancel any
55 pending alarm.
56
57 The type useconds_t is an unsigned integer type capable of holding
58 integers in the range [0,1000000]. On the original BSD implementation,
59 and in glibc before version 2.1, the arguments to ualarm() were instead
60 typed as unsigned int. Programs will be more portable if they never
61 mention useconds_t explicitly.
62
63 The interaction of this function with other timer functions such as
64 alarm(2), sleep(3), nanosleep(2), setitimer(2), timer_create(2),
65 timer_delete(2), timer_getoverrun(2), timer_gettime(2), timer_set‐
66 time(2), usleep(3) is unspecified.
67
68 This function is obsolete. Use setitimer(2) or POSIX interval timers
69 (timer_create(2), etc.) instead.
70
72 alarm(2), getitimer(2), nanosleep(2), select(2), setitimer(2),
73 usleep(3), time(7)
74
76 This page is part of release 3.53 of the Linux man-pages project. A
77 description of the project, and information about reporting bugs, can
78 be found at http://www.kernel.org/doc/man-pages/.
79
80
81
82 2013-04-18 UALARM(3)