Implement a generic polled Alarm function. This merely removes the system
[oota-llvm.git] / include / llvm / System / Alarm.h
1 //===- llvm/System/Alarm.h - Alarm Generation support  ----------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by Reid Spencer and is distributed under the
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file provides an operating system independent interface to alarm(2) 
11 // type functionality. The Alarm class allows a one-shot alarm to be set up 
12 // at some number of seconds in the future. When the alarm triggers, a method
13 // is called to process the event
14 //
15 //===----------------------------------------------------------------------===//
16
17 #ifndef LLVM_SYSTEM_ALARM_H
18 #define LLVM_SYSTEM_ALARM_H
19
20 namespace llvm {
21 namespace sys {
22
23   /// This function registers an alarm to trigger some number of \p seconds in 
24   /// the future. When that time arrives, the \p callback is called. You can
25   /// only call this once. Each time 
26   /// @returns nothing
27   void SetupAlarm(
28     unsigned seconds ///< Number of seconds in future when alarm arrives
29   );
30
31   /// This function terminates the alarm previously set up 
32   /// @returns nothing
33   void TerminateAlarm();
34
35   /// This function acquires the status of the alarm. 
36   /// @returns -1=cancelled, 0=untriggered, 1=triggered
37   int AlarmStatus();
38
39 } // End sys namespace
40 } // End llvm namespace
41
42 #endif