Patchwork [RFC,07/13] osdep: add qemu_msleep

login
register
mail settings
Submitter Paolo Bonzini
Date Aug. 15, 2011, 9:08 p.m.
Message ID <1313442520-12062-8-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/110107/
State New
Headers show

Comments

Paolo Bonzini - Aug. 15, 2011, 9:08 p.m.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 osdep.h       |    1 +
 oslib-posix.c |    7 ++++++-
 oslib-win32.c |    5 +++++
 3 files changed, 12 insertions(+), 1 deletions(-)

Patch

diff --git a/osdep.h b/osdep.h
index a817017..6bf4e1c 100644
--- a/osdep.h
+++ b/osdep.h
@@ -136,6 +136,7 @@  int qemu_madvise(void *addr, size_t len, int advice);
 
 int qemu_create_pidfile(const char *filename);
 int qemu_get_thread_id(void);
+void qemu_msleep(int);
 
 #ifdef _WIN32
 static inline void qemu_timersub(const struct timeval *val1,
diff --git a/oslib-posix.c b/oslib-posix.c
index 196099c..bcbe6a7 100644
--- a/oslib-posix.c
+++ b/oslib-posix.c
@@ -39,7 +39,7 @@  extern int daemon(int, int);
 #include "sysemu.h"
 #include "trace.h"
 #include "qemu_socket.h"
-
+#include <sys/poll.h>
 
 
 int qemu_daemon(int nochdir, int noclose)
@@ -174,3 +174,8 @@  int qemu_utimensat(int dirfd, const char *path, const struct timespec *times,
 
     return utimes(path, &tv[0]);
 }
+
+void qemu_msleep(int msec)
+{
+    poll(NULL, 0, msec);
+}
diff --git a/oslib-win32.c b/oslib-win32.c
index 5f0759f..d823931 100644
--- a/oslib-win32.c
+++ b/oslib-win32.c
@@ -112,3 +112,8 @@  int qemu_gettimeofday(qemu_timeval *tp)
      Do not set errno on error.  */
   return 0;
 }
+
+void qemu_msleep(int msec)
+{
+    Sleep(msec);
+}