qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/7] Enable I/O thread and VNC threads by defaul


From: Stefan Weil
Subject: Re: [Qemu-devel] [PATCH 2/7] Enable I/O thread and VNC threads by default
Date: Thu, 10 Feb 2011 20:46:56 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101226 Iceowl/1.0b1 Icedove/3.0.11

Am 10.02.2011 10:54, schrieb Paolo Bonzini:
On 02/09/2011 11:16 PM, Stefan Weil wrote:
The patch is available here:
http://repo.or.cz/w/qemu/ar7.git/commitdiff/aabf11dc0a938b84d76d7c147cbf0445d7bee297
[snip]
diff --git a/os-win32.c b/os-win32.c
index b214e6a..7778366 100644
--- a/os-win32.c
+++ b/os-win32.c
@@ -36,6 +36,45 @@
 /***********************************************************/
 /* Functions missing in mingw */

+#if defined(CONFIG_THREAD)
+
+int clock_gettime(clockid_t clock_id, struct timespec *pTimespec)
+{
+  int result = 0;
+  if (clock_id == CLOCK_REALTIME && pTimespec != 0) {
+    DWORD t = GetTickCount();
+    const unsigned cps = 1000;
+    struct timespec ts;
+    ts.tv_sec  = t / cps;
+    ts.tv_nsec = (t % cps) * (1000000000UL / cps);
+    *pTimespec = ts;
+  } else {
+    errno = EINVAL;
+    result = -1;
+  }
+  return result;
+}

Why is this needed? The only user of clock_gettime in the POSIX case is using CLOCK_MONOTONIC, and actually has a Win32 version already.


qemu-thread.c uses clock_gettime(CLOCK_REALTIME, ...)



+int pthread_sigmask(int how, const sigset_t *set, sigset_t *oldset)
+{
+    /* Dummy, do nothing. */
+    return EINVAL;
+}
+
+int sigfillset(sigset_t *set)
+{
+    int result = 0;
+    if (set) {
+        *(set) = (sigset_t)(-1);
+    } else {
+        errno = EINVAL;
+        result = -1;
+    }
+    return result;
+}

Instead of these, it's better to provide a Win32 implementation of mutexes and condvars. I'll submit it next week hopefully.

Paolo


That's good news. My patch was only a quick hack to make threaded VNC work.

Thanks,
Stefan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]