Mikhail Glushenkov | 0cdadd8 | 2009-02-08 21:10:57 +0000 | [diff] [blame] | 1 | //===-- Alarm.inc - Implement Win32 Alarm Support ---------------*- C++ -*-===// |
Reid Spencer | b13cf98 | 2005-12-22 03:23:46 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Reid Spencer | b13cf98 | 2005-12-22 03:23:46 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file implements the Win32 Alarm support. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include <cassert> |
| 15 | using namespace llvm; |
| 16 | |
Mikhail Glushenkov | 0cdadd8 | 2009-02-08 21:10:57 +0000 | [diff] [blame] | 17 | /// NestedSOI - Sanity check. Alarms cannot be nested or run in parallel. |
Reid Spencer | b13cf98 | 2005-12-22 03:23:46 +0000 | [diff] [blame] | 18 | /// This ensures that they never do. |
| 19 | static bool NestedSOI = false; |
| 20 | |
| 21 | void sys::SetupAlarm(unsigned seconds) { |
| 22 | assert(!NestedSOI && "sys::SetupAlarm calls cannot be nested!"); |
| 23 | NestedSOI = true; |
| 24 | // FIXME: Implement for Win32 |
| 25 | } |
| 26 | |
| 27 | void sys::TerminateAlarm() { |
| 28 | assert(NestedSOI && "sys::TerminateAlarm called without sys::SetupAlarm!"); |
| 29 | // FIXME: Implement for Win32 |
| 30 | NestedSOI = false; |
| 31 | } |
| 32 | |
| 33 | int sys::AlarmStatus() { |
| 34 | // FIXME: Implement for Win32 |
| 35 | return 0; |
| 36 | } |
Mikhail Glushenkov | ba041f4 | 2009-02-08 22:47:39 +0000 | [diff] [blame] | 37 | |
Julien Lerouge | 9430fe7 | 2009-02-12 07:39:10 +0000 | [diff] [blame] | 38 | // Don't pull in all of the Windows headers. |
Cedric Venet | aff9c27 | 2009-02-14 16:06:42 +0000 | [diff] [blame] | 39 | extern "C" void __stdcall Sleep(unsigned long); |
Julien Lerouge | 9430fe7 | 2009-02-12 07:39:10 +0000 | [diff] [blame] | 40 | |
| 41 | void sys::Sleep(unsigned n) { |
Sebastian Redl | 48fe635 | 2009-03-19 23:26:52 +0000 | [diff] [blame] | 42 | ::Sleep(n*1000); |
Mikhail Glushenkov | ba041f4 | 2009-02-08 22:47:39 +0000 | [diff] [blame] | 43 | } |