ualarm

Section: C Library Functions (3)
Updated: 2026-02-08
Index JM Home Page roff page
 

名前

ualarm - 指定したマイクロ秒後にシグナルを送る予定をする  

ライブラリ

標準 C ライブラリ (libc,~-lc)  

書式

#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
 

説明

ualarm() 関数は、呼び出し元のプロセスに対して usecs マイクロ秒 (以上) 後に SIGALRM シグナルを送る。 遅れはシステムの活性度・呼び出しの処理時間・ システムタイマーの粒度によって長くなるかもしれない。

捕捉または無視されない限り、 SIGALRM シグナルはプロセスを終了させる。

interval 引数が 0 でない場合、最初の SIGALRM シグナルの後、 さらに interval マイクロ秒毎に SIGALRM シグナルが送られる。  

返り値

この関数は、過去に設定された alarm の残りマイクロ秒数を返す。 実行中の alarm がない場合は 0 を返す。  

エラー

EINTR
シグナルによって中断された。 signal(7) 参照。
EINVAL
usecs or interval is not smaller than 1000000. (On systems where that is considered an error.)
 

属性

この節で使用されている用語の説明については、 attributes(7) を参照。
インターフェース属性値

 ualarm()
Thread safetyMT-Safe
 

標準規格

なし。  

歴史

4.3BSD, POSIX.1-2001. POSIX.1-2001 marks it as obsolete. Removed in POSIX.1-2008.

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) など) を使うこと。  

関連項目

alarm(2), getitimer(2), nanosleep(2), select(2), setitimer(2), usleep(3), time(7)


 

Index

名前
ライブラリ
書式
説明
返り値
エラー
属性
標準規格
歴史
関連項目

This document was created by man2html, using the manual pages.