From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45191) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SFkQg-0007jL-1m for qemu-devel@nongnu.org; Thu, 05 Apr 2012 07:03:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SFkPR-00074w-Hs for qemu-devel@nongnu.org; Thu, 05 Apr 2012 07:00:37 -0400 Received: from david.siemens.de ([192.35.17.14]:29886) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SFkPR-00073q-7O for qemu-devel@nongnu.org; Thu, 05 Apr 2012 06:59:21 -0400 From: Jan Kiszka Date: Thu, 5 Apr 2012 12:59:10 +0200 Message-Id: <3c04deb7651b2d9e7df82a7917a7d13a198b7c98.1333623555.git.jan.kiszka@siemens.com> In-Reply-To: References: In-Reply-To: References: Subject: [Qemu-devel] [PATCH v3 03/10] Switch compatfd to QEMU thread List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori , qemu-devel@nongnu.org Cc: Kevin Wolf , Paolo Bonzini qemu_thread_create already does signal blocking and detaching for us. Signed-off-by: Jan Kiszka --- 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 -#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.7.3.4