Received: from eggs.gnu.org ([2001:4830:134:3::10]:41260) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWppD-0006sf-JC for qemu-devel@nongnu.org; Thu, 17 Oct 2013 11:49:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VWpow-0000hd-T8 for qemu-devel@nongnu.org; Thu, 17 Oct 2013 11:49:23 -0400 Received: from mail-ea0-x234.google.com ([2a00:1450:4013:c01::234]:48554) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWpow-0000gx-Mm for qemu-devel@nongnu.org; Thu, 17 Oct 2013 11:49:06 -0400 Received: by mail-ea0-f180.google.com with SMTP id h10so1176992eaj.11 for ; Thu, 17 Oct 2013 08:49:05 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Thu, 17 Oct 2013 17:48:40 +0200 Message-Id: <1382024935-28297-3-git-send-email-pbonzini@redhat.com> In-Reply-To: <1382024935-28297-1-git-send-email-pbonzini@redhat.com> References: <1382024935-28297-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 02/17] 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