2009-02-09 05:10:57 +08:00
|
|
|
//===-- Alarm.inc - Implement Win32 Alarm Support ---------------*- C++ -*-===//
|
2005-12-22 11:23:46 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-30 04:36:04 +08:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-12-22 11:23:46 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file implements the Win32 Alarm support.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include <cassert>
|
|
|
|
using namespace llvm;
|
|
|
|
|
2009-02-09 05:10:57 +08:00
|
|
|
/// NestedSOI - Sanity check. Alarms cannot be nested or run in parallel.
|
2005-12-22 11:23:46 +08:00
|
|
|
/// This ensures that they never do.
|
|
|
|
static bool NestedSOI = false;
|
|
|
|
|
|
|
|
void sys::SetupAlarm(unsigned seconds) {
|
|
|
|
assert(!NestedSOI && "sys::SetupAlarm calls cannot be nested!");
|
|
|
|
NestedSOI = true;
|
|
|
|
// FIXME: Implement for Win32
|
|
|
|
}
|
|
|
|
|
|
|
|
void sys::TerminateAlarm() {
|
|
|
|
assert(NestedSOI && "sys::TerminateAlarm called without sys::SetupAlarm!");
|
|
|
|
// FIXME: Implement for Win32
|
|
|
|
NestedSOI = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
int sys::AlarmStatus() {
|
|
|
|
// FIXME: Implement for Win32
|
|
|
|
return 0;
|
|
|
|
}
|
2009-02-09 06:47:39 +08:00
|
|
|
|
2009-02-12 15:39:10 +08:00
|
|
|
// Don't pull in all of the Windows headers.
|
2009-02-15 00:06:42 +08:00
|
|
|
extern "C" void __stdcall Sleep(unsigned long);
|
2009-02-12 15:39:10 +08:00
|
|
|
|
|
|
|
void sys::Sleep(unsigned n) {
|
2009-03-20 07:26:52 +08:00
|
|
|
::Sleep(n*1000);
|
2009-02-09 06:47:39 +08:00
|
|
|
}
|