#include <unistd.h> useconds_t ualarm(useconds_t usecs, useconds_t interval);
glibc 向けの機能検査マクロの要件 (feature_test_macros(7) 参照):
ualarm():
Since glibc 2.12:
(_XOPEN_SOURCE >= 500) && ! (_POSIX_C_SOURCE >= 200809L)
|| /* glibc >= 2.19: */ _DEFAULT_SOURCE
|| /* glibc <= 2.19: */ _BSD_SOURCE
Before glibc 2.12:
_BSD_SOURCE || _XOPEN_SOURCE >= 500
捕捉または無視されない限り、 SIGALRM シグナルはプロセスを終了させる。
interval 引数が 0 でない場合、最初の SIGALRM シグナルの後、 さらに interval マイクロ秒毎に SIGALRM シグナルが送られる。
| インターフェース | 属性 | 値 |
|
ualarm() | Thread safety | MT-Safe |
4.3BSD, SUSv2, and POSIX do not define any errors.
POSIX.1-2001 では、 usecs 引数が 0 の場合、何が起こるかは規定されていない。 Linux (やおそらく他ほとんどのシステム) では、 usecs 引数が 0 の場合、処理待ちのアラームがキャンセルされる。
The type useconds_t is an unsigned integer type capable of holding integers in the range [0,1000000]. On the original BSD implementation, and in glibc before glibc 2.1, the arguments to ualarm() were instead typed as unsigned int. Programs will be more portable if they never mention useconds_t explicitly.
この関数と alarm(2), sleep(3), nanosleep(2), setitimer(2), timer_create(2), timer_delete(2), timer_getoverrun(2), timer_gettime(2), timer_settime(2), usleep(3) のような他のタイマー関数との相互作用は規定されていない。
この関数は廃止予定である。 代わりに setitimer(2) もしくは POSIX インターバルタイマー (timer_create(2) など) を使うこと。