Signed-off-by: Anthony Liguori <aligu...@us.ibm.com>
diff --git a/qemu-thread.c b/qemu-thread.c
index 748da5e..6d0c51e 100644
--- a/qemu-thread.c
+++ b/qemu-thread.c
@@ -14,6 +14,31 @@
#include "qemu-common.h"
#include "qemu-thread.h"
+#ifdef _WIN32
+GThread *q_thread_create_nosignal(GThreadFunc func,
+ gpointer data,
+ gboolean joinable,
+ GError **error)
+{
+ return g_thread_create(func, data, joinable, NULL);
+}
+#else
+GThread *q_thread_create_nosignal(GThreadFunc func,
+ gpointer data,
+ gboolean joinable,
+ GError **error)
+{
+ GThread *tid;
+ sigset_t set, old;
+
+ sigfillset(&set);
+ pthread_sigmask(SIG_SETMASK, &set, &old);
+ tid = g_thread_create(func, data, joinable, error);
+ pthread_sigmask(SIG_SETMASK, &old, NULL);
+ return tid;
+}
+#endif
+
struct trampoline_data
{
QemuThread *thread;
diff --git a/qemu-thread.h b/qemu-thread.h
index 2c99c94..ec7fabd 100644
--- a/qemu-thread.h
+++ b/qemu-thread.h
@@ -10,6 +10,11 @@ struct QemuThread {
typedef struct QemuThread QemuThread;
+GThread *q_thread_create_nosignal(GThreadFunc func,
+ gpointer data,
+ gboolean joinable,
+ GError **error);
+
void qemu_thread_create(QemuThread *thread,
void *(*start_routine)(void*),
void *arg);
diff --git a/ui/vnc-jobs-async.c b/ui/vnc-jobs-async.c
index 0c2b1a0..2df245d 100644
--- a/ui/vnc-jobs-async.c
+++ b/ui/vnc-jobs-async.c
@@ -51,7 +51,7 @@
struct VncJobQueue {
GCond *cond;
GStaticMutex mutex;
- QemuThread thread;
+ GThread *thread;
Buffer buffer;
bool exit;
QTAILQ_HEAD(, VncJob) jobs;
@@ -289,11 +289,11 @@ static void vnc_queue_clear(VncJobQueue *q)
queue = NULL; /* Unset global queue */
}
-static void *vnc_worker_thread(void *arg)
+static gpointer vnc_worker_thread(gpointer arg)
{
VncJobQueue *queue = arg;
- qemu_thread_self(&queue->thread);
+ queue->thread = g_thread_self();
while (!vnc_worker_thread_loop(queue)) ;
vnc_queue_clear(queue);
@@ -308,7 +308,7 @@ void vnc_start_worker_thread(void)
return ;
q = vnc_queue_init();
- qemu_thread_create(&q->thread, vnc_worker_thread, q);
+ q->thread = q_thread_create_nosignal(vnc_worker_thread, q, FALSE, NULL);
queue = q; /* Set global queue */
}
--
1.7.0.4