From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LfOVn-0000xF-Lj for qemu-devel@nongnu.org; Thu, 05 Mar 2009 20:06:03 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LfOVm-0000x3-6T for qemu-devel@nongnu.org; Thu, 05 Mar 2009 20:06:03 -0500 Received: from [199.232.76.173] (port=44779 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LfOVm-0000x0-3i for qemu-devel@nongnu.org; Thu, 05 Mar 2009 20:06:02 -0500 Received: from mail2.shareable.org ([80.68.89.115]:51750) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LfOVl-000695-LE for qemu-devel@nongnu.org; Thu, 05 Mar 2009 20:06:01 -0500 Received: from jamie by mail2.shareable.org with local (Exim 4.63) (envelope-from ) id 1LfOVf-0003gH-MZ for qemu-devel@nongnu.org; Fri, 06 Mar 2009 01:05:55 +0000 Date: Fri, 6 Mar 2009 01:05:55 +0000 From: Jamie Lokier Subject: Re: [Qemu-devel] Race condition between signal handler and cpu_exec() Message-ID: <20090306010555.GC13735@shareable.org> References: <20090305221412.GI17410@hall.aurel32.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090305221412.GI17410@hall.aurel32.net> 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 Aurelien Jarno wrote: > I am currently too tired to find a proper solution (which should only > use read/write to a variable to keep the operations atomic), I'll look > at that tomorrow, but patches are welcome in the meanwhile. The theoretically right thing in C is read/write a "volatile sig_atomic_t". The GNU/Linux libc manual has a section "Atomic Data Access and Signal Handling", where it says you can assume read/writing an "int" and a pointer are also atomic in this respect on all machines which matter. Note that writing to a "char" is not atomic on old Alphas. -- Jamie