[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 02/17] compatfd: switch to QemuThread
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 02/17] compatfd: switch to QemuThread |
Date: |
Thu, 17 Oct 2013 17:48:40 +0200 |
From: Jan Kiszka <address@hidden>
qemu_thread_create already does signal blocking and detaching for us.
Signed-off-by: Jan Kiszka <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
util/compatfd.c | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/util/compatfd.c b/util/compatfd.c
index 9cf3f28..430a41c 100644
--- a/util/compatfd.c
+++ b/util/compatfd.c
@@ -15,9 +15,9 @@
#include "qemu-common.h"
#include "qemu/compatfd.h"
+#include "qemu/thread.h"
#include <sys/syscall.h>
-#include <pthread.h>
struct sigfd_compat_info
{
@@ -28,10 +28,6 @@ struct sigfd_compat_info
static void *sigwait_compat(void *opaque)
{
struct sigfd_compat_info *info = opaque;
- sigset_t all;
-
- sigfillset(&all);
- pthread_sigmask(SIG_BLOCK, &all, NULL);
while (1) {
int sig;
@@ -71,9 +67,8 @@ static void *sigwait_compat(void *opaque)
static int qemu_signalfd_compat(const sigset_t *mask)
{
- pthread_attr_t attr;
- pthread_t tid;
struct sigfd_compat_info *info;
+ QemuThread thread;
int fds[2];
info = malloc(sizeof(*info));
@@ -93,12 +88,7 @@ static int qemu_signalfd_compat(const sigset_t *mask)
memcpy(&info->mask, mask, sizeof(*mask));
info->fd = fds[1];
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-
- pthread_create(&tid, &attr, sigwait_compat, info);
-
- pthread_attr_destroy(&attr);
+ qemu_thread_create(&thread, sigwait_compat, info, QEMU_THREAD_DETACHED);
return fds[0];
}
--
1.8.3.1
- [Qemu-devel] [PULL 00/17] Memory/threading changes for 1.7, Paolo Bonzini, 2013/10/17
- [Qemu-devel] [PULL 01/17] memory: fix 128 arithmetic in info mtree, Paolo Bonzini, 2013/10/17
- [Qemu-devel] [PULL 02/17] compatfd: switch to QemuThread,
Paolo Bonzini <=
- [Qemu-devel] [PULL 04/17] cirrus: Mark vga io region as coalesced MMIO flushing, Paolo Bonzini, 2013/10/17
- [Qemu-devel] [PULL 05/17] vga: Mark relevant portio lists regions as coalesced MMIO flushing, Paolo Bonzini, 2013/10/17
- [Qemu-devel] [PULL 03/17] portio: Allow to mark portio lists as coalesced MMIO flushing, Paolo Bonzini, 2013/10/17
- [Qemu-devel] [PULL 10/17] timer: extract timer_mod_ns_locked and timerlist_rearm, Paolo Bonzini, 2013/10/17
- [Qemu-devel] [PULL 11/17] timer: add timer_mod_anticipate and timer_mod_anticipate_ns, Paolo Bonzini, 2013/10/17
- [Qemu-devel] [PULL 07/17] timer: protect timers_state's clock with seqlock, Paolo Bonzini, 2013/10/17
- [Qemu-devel] [PULL 06/17] seqlock: introduce read-write seqlock, Paolo Bonzini, 2013/10/17
- [Qemu-devel] [PULL 08/17] qemu-thread: add QemuEvent, Paolo Bonzini, 2013/10/17
- [Qemu-devel] [PULL 12/17] icount: use cpu_get_icount() directly, Paolo Bonzini, 2013/10/17
- [Qemu-devel] [PULL 09/17] timer: make qemu_clock_enable sync between disable and timer's cb, Paolo Bonzini, 2013/10/17