From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LdlKg-0006WX-Ip for qemu-devel@nongnu.org; Sun, 01 Mar 2009 08:03:50 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LdlKd-0006Vf-4w for qemu-devel@nongnu.org; Sun, 01 Mar 2009 08:03:49 -0500 Received: from [199.232.76.173] (port=53724 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LdlKc-0006VU-CV for qemu-devel@nongnu.org; Sun, 01 Mar 2009 08:03:46 -0500 Received: from mx20.gnu.org ([199.232.41.8]:53204) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LdlKb-000598-SH for qemu-devel@nongnu.org; Sun, 01 Mar 2009 08:03:46 -0500 Received: from mail.codesourcery.com ([65.74.133.4]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LdlKZ-0006tc-Pr for qemu-devel@nongnu.org; Sun, 01 Mar 2009 08:03:44 -0500 From: Paul Brook Subject: Re: [Qemu-devel] Re: [PATCH] Fix freezing bug in curses console Date: Sun, 1 Mar 2009 13:03:37 +0000 References: <20090228212116.GL20640@shareable.org> <20090301113635.GA10538@redhat.com> In-Reply-To: <20090301113635.GA10538@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200903011303.38741.paul@codesourcery.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, "Daniel P. Berrange" Cc: Matthew Bloch , kvm@vger.kernel.org > > > I think it still suffers from the same race condition so today it > > > wouldn't work. You could fix the bottom half scheduling though so that > > > you could safely schedule a bottom half from a signal handler (using > > > roughly the same trick). > > > > Fwiw, it's perfectly sensible to have a single pipe which is shared by > > all signal handlers, just used to say "check for work flags set". > > And if you need the main loop to be able to distinguish signals coming > out of the pipe, then just write the signum into the pipe as a byte, > instead of a single dummy byte. Or even write the whole 'siginfo_t' > struct passed to the signal handler, and read it out in sizeof(siginfo_t) > sized chunks for processing. I don't think this will works. If the pipe buffer gets full the write will either block or you'll loose signals. When using the pipe as a simple semaphore all you care about is the presence or absence of data. It doesn't matter if subsequent writes loose data (e.g. by not retrying a nonblocking write) as long as a write to an empty pipe succeeds. Paul