LLVM API Documentation

Alarm.h

Go to the documentation of this file.
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 namespace llvm {
00021 namespace sys {
00022 
00023   /// This function registers an alarm to trigger some number of \p seconds in 
00024   /// the future. When that time arrives, the AlarmStatus function will begin
00025   /// to return 1 instead of 0. The user must poll the status of the alarm by
00026   /// making occasional calls to AlarmStatus. If the user sends an interrupt
00027   /// signal, AlarmStatus will begin returning -1, even if the alarm event
00028   /// occurred.
00029   /// @returns nothing
00030   void SetupAlarm(
00031     unsigned seconds ///< Number of seconds in future when alarm arrives
00032   );
00033 
00034   /// This function terminates the alarm previously set up 
00035   /// @returns nothing
00036   void TerminateAlarm();
00037 
00038   /// This function acquires the status of the alarm. 
00039   /// @returns -1=cancelled, 0=untriggered, 1=triggered
00040   int AlarmStatus();
00041 
00042 } // End sys namespace
00043 } // End llvm namespace
00044 
00045 #endif