blob: e0d00a0142bfac4a4bce0d13109db85b4eae801b [file] [log] [blame]
Mikhail Glushenkov0cdadd82009-02-08 21:10:57 +00001//===-- Alarm.inc - Implement Win32 Alarm Support ---------------*- C++ -*-===//
Reid Spencerb13cf982005-12-22 03:23:46 +00002//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Reid Spencerb13cf982005-12-22 03:23:46 +00007//
8//===----------------------------------------------------------------------===//
9//
10// This file implements the Win32 Alarm support.
11//
12//===----------------------------------------------------------------------===//
13
14#include <cassert>
15using namespace llvm;
16
Mikhail Glushenkov0cdadd82009-02-08 21:10:57 +000017/// NestedSOI - Sanity check. Alarms cannot be nested or run in parallel.
Reid Spencerb13cf982005-12-22 03:23:46 +000018/// This ensures that they never do.
19static bool NestedSOI = false;
20
21void sys::SetupAlarm(unsigned seconds) {
22 assert(!NestedSOI && "sys::SetupAlarm calls cannot be nested!");
23 NestedSOI = true;
24 // FIXME: Implement for Win32
25}
26
27void sys::TerminateAlarm() {
28 assert(NestedSOI && "sys::TerminateAlarm called without sys::SetupAlarm!");
29 // FIXME: Implement for Win32
30 NestedSOI = false;
31}
32
33int sys::AlarmStatus() {
34 // FIXME: Implement for Win32
35 return 0;
36}
Mikhail Glushenkovba041f42009-02-08 22:47:39 +000037
Julien Lerouge9430fe72009-02-12 07:39:10 +000038// Don't pull in all of the Windows headers.
Cedric Venetaff9c272009-02-14 16:06:42 +000039extern "C" void __stdcall Sleep(unsigned long);
Julien Lerouge9430fe72009-02-12 07:39:10 +000040
41void sys::Sleep(unsigned n) {
Sebastian Redl48fe6352009-03-19 23:26:52 +000042 ::Sleep(n*1000);
Mikhail Glushenkovba041f42009-02-08 22:47:39 +000043}