版權所有 © 2014 tutorialspoint
#include <signal.h> int sigwaitinfo(const sigset_t *set, siginfo_t *info); int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *timeout);
int sigwaitinfo(const sigset_t *set, siginfo_t *info);
int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *timeout);
sigwaitinfo() 從呼叫程序的掛起訊號列表中刪除已傳遞的訊號,並將其訊號編號作為函式結果返回。如果info引數不是NULL,則它返回siginfo_t型別(參見sigaction(2))的結構,其中包含有關訊號的資訊。
透過sigwaitinfo() 返回的訊號按通常順序傳遞;有關更多詳細資訊,請參見signal(7)。
sigtimedwait() 的操作方式與sigwaitinfo() 完全相同,只是它還有一個附加引數timeout,它允許對程序掛起的時間設定上限。此引數的型別如下:
struct timespec { long tv_sec; /* seconds */ long tv_nsec; /* nanoseconds */ }
如果此結構的兩個欄位都指定為 0,則執行輪詢:sigtimedwait() 立即返回,或者返回有關已為呼叫者掛起的訊號的資訊,或者如果set中的任何訊號均未掛起,則返回錯誤。
POSIX 未指定sigtimedwait() 的timeout引數的NULL值的含義,允許此含義與對sigwaitinfo() 的呼叫的含義相同,實際上這就是Linux上的操作方式。
kill (2)
sigaction (2)
signal (2)
sigpending (2)
sigprocmask (2)
sigqueue (2)
廣告