From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:35143) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUS2W-0008T5-4Z for qemu-devel@nongnu.org; Wed, 08 Jun 2011 19:19:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QUS2U-0006R5-T1 for qemu-devel@nongnu.org; Wed, 08 Jun 2011 19:19:56 -0400 Received: from mail-pw0-f45.google.com ([209.85.160.45]:58760) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUS2U-0006R1-OP for qemu-devel@nongnu.org; Wed, 08 Jun 2011 19:19:54 -0400 Received: by pwi6 with SMTP id 6so495966pwi.4 for ; Wed, 08 Jun 2011 16:19:53 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1307573737-33421-1-git-send-email-agraf@suse.de> References: <1307573737-33421-1-git-send-email-agraf@suse.de> From: Alexandre Raymond Date: Wed, 8 Jun 2011 19:19:33 -0400 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] sigfd: use pthread_sigmask List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: Paolo Bonzini , =?UTF-8?Q?Andreas_F=C3=A4rber?= , qemu-devel Developers , Jan Kiszka On Wed, Jun 8, 2011 at 6:55 PM, Alexander Graf wrote: > Qemu uses signalfd to figure out, if a signal occured without the need > to actually receive the signal. Instead, it can read from the fd to recei= ve > its news. > > Now, we obviously don't always have signalfd around. Especially not on > non-Linux systems. So what we do there is that we create a new thread, > block that thread on all signals and simply call sigwait to wait for a > signal we're interested in to occur. > > This all sounds great, but what we're really doing is: > > =C2=A0 =C2=A0sigset_t all; > > =C2=A0 =C2=A0sigfillset(&all); > =C2=A0 =C2=A0sigprocmask(SIG_BLOCK, &all, NULL); > > which - on Darwin - blocks all signals on the current _process_, not only > on the current thread. To block signals on the thread, we can use > pthread_sigmask(). > > This patch does that, assuming that my above analysis is correct, and thu= s > renders Qemu useable on Darwin again. I confirm that Qemu works much better on Darwin with this patch :) Thanks! Alexandre