diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2013-02-20 14:43:31 +0100 |
---|---|---|
committer | Stefan Weil <sw@weilnetz.de> | 2013-04-12 18:27:16 +0200 |
commit | 0727b867542eea7fedfd2c53568e9782627fd3bd (patch) | |
tree | cb57f294e4de0bfd0e87a81e2b594c4946abc5d3 /os-win32.c | |
parent | 1046127d1fcc69359b3f5a44de08e6c5b16c90bc (diff) |
qemu-timer: move timeBeginPeriod/timeEndPeriod to os-win32
These are needed for any of the Win32 alarm timer implementations.
They are not tied to mmtimer exclusively.
Jacob tested this patch with both mmtimer and Win32 timers.
Cc: qemu-stable@nongnu.org
Tested-by: Jacob Kroon <jacob.kroon@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Diffstat (limited to 'os-win32.c')
-rw-r--r-- | os-win32.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/os-win32.c b/os-win32.c index c7f6b5c6b0..50b7f6f885 100644 --- a/os-win32.c +++ b/os-win32.c @@ -23,6 +23,7 @@ * THE SOFTWARE. */ #include <windows.h> +#include <mmsystem.h> #include <unistd.h> #include <fcntl.h> #include <signal.h> @@ -67,9 +68,19 @@ static BOOL WINAPI qemu_ctrl_handler(DWORD type) return TRUE; } +static TIMECAPS mm_tc; + +static void os_undo_timer_resolution(void) +{ + timeEndPeriod(mm_tc.wPeriodMin); +} + void os_setup_early_signal_handling(void) { SetConsoleCtrlHandler(qemu_ctrl_handler, TRUE); + timeGetDevCaps(&mm_tc, sizeof(mm_tc)); + timeBeginPeriod(mm_tc.wPeriodMin); + atexit(os_undo_timer_resolution); } /* Look for support files in the same directory as the executable. */ |