[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 03/10] Switch compatfd to QEMU thread
From: |
Jan Kiszka |
Subject: |
[Qemu-devel] [PATCH v3 03/10] Switch compatfd to QEMU thread |
Date: |
Thu, 5 Apr 2012 12:59:10 +0200 |
qemu_thread_create already does signal blocking and detaching for us.
Signed-off-by: Jan Kiszka <address@hidden>
---
compatfd.c | 16 +++-------------
1 files changed, 3 insertions(+), 13 deletions(-)
diff --git a/compatfd.c b/compatfd.c
index 42f81ca..8d5a63f 100644
--- a/compatfd.c
+++ b/compatfd.c
@@ -14,10 +14,10 @@
*/
#include "qemu-common.h"
+#include "qemu-thread.h"
#include "compatfd.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.7.3.4
- Re: [Qemu-devel] [PATCH v3 01/10] Introduce qemu_cond_timedwait for POSIX, (continued)
- Re: [Qemu-devel] [PATCH v3 01/10] Introduce qemu_cond_timedwait for POSIX, malc, 2012/04/05
- Re: [Qemu-devel] [PATCH v3 01/10] Introduce qemu_cond_timedwait for POSIX, Paolo Bonzini, 2012/04/05
- Re: [Qemu-devel] [PATCH v3 01/10] Introduce qemu_cond_timedwait for POSIX, Jan Kiszka, 2012/04/05
- Re: [Qemu-devel] [PATCH v3 01/10] Introduce qemu_cond_timedwait for POSIX, malc, 2012/04/05
- Re: [Qemu-devel] [PATCH v3 01/10] Introduce qemu_cond_timedwait for POSIX, Jan Kiszka, 2012/04/05
- Re: [Qemu-devel] [PATCH v3 01/10] Introduce qemu_cond_timedwait for POSIX, malc, 2012/04/05
- Re: [Qemu-devel] [PATCH v3 01/10] Introduce qemu_cond_timedwait for POSIX, Jan Kiszka, 2012/04/05
- Re: [Qemu-devel] [PATCH v3 01/10] Introduce qemu_cond_timedwait for POSIX, malc, 2012/04/05
- Re: [Qemu-devel] [PATCH v3 01/10] Introduce qemu_cond_timedwait for POSIX, malc, 2012/04/05
[Qemu-devel] [PATCH v3 04/10] qemu-thread: Factor out qemu_error_exit, Jan Kiszka, 2012/04/05
[Qemu-devel] [PATCH v3 03/10] Switch compatfd to QEMU thread,
Jan Kiszka <=
[Qemu-devel] [PATCH v3 05/10] Introduce QemuEvent abstraction, Jan Kiszka, 2012/04/05
[Qemu-devel] [PATCH v3 02/10] Switch POSIX compat AIO to QEMU abstractions, Jan Kiszka, 2012/04/05
[Qemu-devel] [PATCH v3 06/10] Use QemuEvent in main loop, Jan Kiszka, 2012/04/05
[Qemu-devel] [PATCH v3 07/10] Drop unused qemu_eventfd, Jan Kiszka, 2012/04/05
[Qemu-devel] [PATCH v3 10/10] Remove EventNotifier, Jan Kiszka, 2012/04/05
[Qemu-devel] [PATCH v3 08/10] Use QemuEvent for POSIX AIO, Jan Kiszka, 2012/04/05