[llvm-commits] [llvm] r64101 - in /llvm/trunk: include/llvm/System/Alarm.h lib/System/Unix/Alarm.inc lib/System/Win32/Alarm.inc
Mikhail Glushenkov
foldr at codedgers.com
Sun Feb 8 14:47:39 PST 2009
Author: foldr
Date: Sun Feb 8 16:47:39 2009
New Revision: 64101
URL: http://llvm.org/viewvc/llvm-project?rev=64101&view=rev
Log:
Add a Sleep() function.
Modified:
llvm/trunk/include/llvm/System/Alarm.h
llvm/trunk/lib/System/Unix/Alarm.inc
llvm/trunk/lib/System/Win32/Alarm.inc
Modified: llvm/trunk/include/llvm/System/Alarm.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Alarm.h?rev=64101&r1=64100&r2=64101&view=diff
==============================================================================
--- llvm/trunk/include/llvm/System/Alarm.h (original)
+++ llvm/trunk/include/llvm/System/Alarm.h Sun Feb 8 16:47:39 2009
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
//
-// This file provides an operating system independent interface to alarm(2)
-// type functionality. The Alarm class allows a one-shot alarm to be set up
+// This file provides an operating system independent interface to alarm(2)
+// type functionality. The Alarm class allows a one-shot alarm to be set up
// at some number of seconds in the future. When the alarm triggers, a method
// is called to process the event
//
@@ -20,7 +20,7 @@
namespace llvm {
namespace sys {
- /// This function registers an alarm to trigger some number of \p seconds in
+ /// This function registers an alarm to trigger some number of \p seconds in
/// the future. When that time arrives, the AlarmStatus function will begin
/// to return 1 instead of 0. The user must poll the status of the alarm by
/// making occasional calls to AlarmStatus. If the user sends an interrupt
@@ -31,14 +31,19 @@
unsigned seconds ///< Number of seconds in future when alarm arrives
);
- /// This function terminates the alarm previously set up
+ /// This function terminates the alarm previously set up
/// @returns nothing
void TerminateAlarm();
- /// This function acquires the status of the alarm.
+ /// This function acquires the status of the alarm.
/// @returns -1=cancelled, 0=untriggered, 1=triggered
int AlarmStatus();
+ /// Sleep for n seconds.
+ /// @returns nothing.
+ void Sleep(unsigned n);
+
+
} // End sys namespace
} // End llvm namespace
Modified: llvm/trunk/lib/System/Unix/Alarm.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Alarm.inc?rev=64101&r1=64100&r2=64101&view=diff
==============================================================================
--- llvm/trunk/lib/System/Unix/Alarm.inc (original)
+++ llvm/trunk/lib/System/Unix/Alarm.inc Sun Feb 8 16:47:39 2009
@@ -66,3 +66,7 @@
return 1;
return 0;
}
+
+void Sleep(unsigned n) {
+ ::sleep(n);
+}
Modified: llvm/trunk/lib/System/Win32/Alarm.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/Alarm.inc?rev=64101&r1=64100&r2=64101&view=diff
==============================================================================
--- llvm/trunk/lib/System/Win32/Alarm.inc (original)
+++ llvm/trunk/lib/System/Win32/Alarm.inc Sun Feb 8 16:47:39 2009
@@ -34,3 +34,7 @@
// FIXME: Implement for Win32
return 0;
}
+
+void Sleep(unsigned n) {
+ Sleep(n*1000);
+}
More information about the llvm-commits
mailing list