LLVM API Documentation
00001 //===- llvm/System/Alarm.h - Alarm Generation support ----------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file was developed by Reid Spencer and is distributed under the 00006 // University of Illinois Open Source License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file provides an operating system independent interface to alarm(2) 00011 // type functionality. The Alarm class allows a one-shot alarm to be set up 00012 // at some number of seconds in the future. When the alarm triggers, a method 00013 // is called to process the event 00014 // 00015 //===----------------------------------------------------------------------===// 00016 00017 #ifndef LLVM_SYSTEM_ALARM_H 00018 #define LLVM_SYSTEM_ALARM_H 00019 00020 #include "llvm/System/IncludeFile.h" 00021 00022 namespace llvm { 00023 namespace sys { 00024 00025 /// This function registers an alarm to trigger some number of \p seconds in 00026 /// the future. When that time arrives, the AlarmStatus function will begin 00027 /// to return 1 instead of 0. The user must poll the status of the alarm by 00028 /// making occasional calls to AlarmStatus. If the user sends an interrupt 00029 /// signal, AlarmStatus will begin returning -1, even if the alarm event 00030 /// occurred. 00031 /// @returns nothing 00032 void SetupAlarm( 00033 unsigned seconds ///< Number of seconds in future when alarm arrives 00034 ); 00035 00036 /// This function terminates the alarm previously set up 00037 /// @returns nothing 00038 void TerminateAlarm(); 00039 00040 /// This function acquires the status of the alarm. 00041 /// @returns -1=cancelled, 0=untriggered, 1=triggered 00042 int AlarmStatus(); 00043 00044 } // End sys namespace 00045 } // End llvm namespace 00046 00047 FORCE_DEFINING_FILE_TO_BE_LINKED(SystemAlarm) 00048 00049 #endif