From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57565) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRj6S-0002JC-VT for qemu-devel@nongnu.org; Thu, 03 Oct 2013 09:38:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VRj6N-0006TJ-Q8 for qemu-devel@nongnu.org; Thu, 03 Oct 2013 09:38:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24648) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRj6N-0006TC-IF for qemu-devel@nongnu.org; Thu, 03 Oct 2013 09:37:59 -0400 From: Paolo Bonzini Date: Thu, 3 Oct 2013 15:37:51 +0200 Message-Id: <1380807471-12932-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH] compatfd: switch to QemuThread List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Jan Kiszka From: Jan Kiszka qemu_thread_create already does signal blocking and detaching for us. Signed-off-by: Jan Kiszka Signed-off-by: Paolo Bonzini --- 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 -#include 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