alarm() - Unix,Linux 系統呼叫 - 技術教學
Tutorials Point


  Unix 初學者教程
  Unix Shell 程式設計
  高階 Unix
  Unix 有用參考
  Unix 有用資源
  精選閱讀

版權所有 © 2014 tutorialspoint



  首頁     參考資料     討論論壇     關於 TP  

alarm() - Unix,Linux 系統呼叫


previous next AddThis Social Bookmark Button

廣告

名稱

alarm - 設定訊號傳遞的鬧鐘

概要

#include <unistd.h> 

unsigned int alarm(unsigned int seconds);

描述

alarm() 安排在 seconds 秒後向程序傳遞 SIGALRM 訊號。

如果 seconds 為零,則不安排新的 alarm()。

無論如何,任何先前設定的 alarm() 都將被取消。

返回值

alarm() 返回先前安排的鬧鐘還有多少秒將被傳遞,如果沒有先前安排的鬧鐘則返回零。

備註

alarm() 和 setitimer() 共享同一個計時器;對一個的呼叫會干擾另一個的使用。

sleep() 可能使用 SIGALRM 實現;混合呼叫 alarm() 和 sleep() 不是一個好主意。

排程延遲可能,一如既往,導致程序執行被任意時間延遲。

符合標準

SVr4, POSIX.1-2001, 4.3BSD

參見



previous next Printer Friendly

廣告


  

廣告



廣告
© . All rights reserved.