1 //===- llvm/System/Alarm.h - Alarm Generation support ----------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
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.
8 //===----------------------------------------------------------------------===//
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
15 //===----------------------------------------------------------------------===//
17 #ifndef LLVM_SYSTEM_ALARM_H
18 #define LLVM_SYSTEM_ALARM_H
20 #include "llvm/System/IncludeFile.h"
25 /// This function registers an alarm to trigger some number of \p seconds in
26 /// the future. When that time arrives, the AlarmStatus function will begin
27 /// to return 1 instead of 0. The user must poll the status of the alarm by
28 /// making occasional calls to AlarmStatus. If the user sends an interrupt
29 /// signal, AlarmStatus will begin returning -1, even if the alarm event
33 unsigned seconds ///< Number of seconds in future when alarm arrives
36 /// This function terminates the alarm previously set up
38 void TerminateAlarm();
40 /// This function acquires the status of the alarm.
41 /// @returns -1=cancelled, 0=untriggered, 1=triggered
44 } // End sys namespace
45 } // End llvm namespace
47 FORCE_DEFINING_FILE_TO_BE_LINKED(SystemAlarm)