From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51256) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tdzb8-00007K-74 for qemu-devel@nongnu.org; Thu, 29 Nov 2012 03:35:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tdzb6-00015v-Fr for qemu-devel@nongnu.org; Thu, 29 Nov 2012 03:35:54 -0500 Received: from mail-wg0-f53.google.com ([74.125.82.53]:38978) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tdzb6-00015r-8R for qemu-devel@nongnu.org; Thu, 29 Nov 2012 03:35:52 -0500 Received: by mail-wg0-f53.google.com with SMTP id e12so4836220wge.10 for ; Thu, 29 Nov 2012 00:35:51 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <50B64704.5040606@twiddle.net> References: <1353808984-22368-1-git-send-email-qemulist@gmail.com> <1353808984-22368-2-git-send-email-qemulist@gmail.com> <50B64704.5040606@twiddle.net> From: liu ping fan Date: Thu, 29 Nov 2012 16:35:31 +0800 Message-ID: Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Qemu-devel] [PATCH v7 1/7] qom: apply atomic on object's refcount List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: Peter Maydell , gleb@redhat.com, Jan Kiszka , Marcelo Tosatti , qemu-devel@nongnu.org, Anthony Liguori , Stefan Hajnoczi , Paolo Bonzini On Thu, Nov 29, 2012 at 1:16 AM, Richard Henderson wrote: > On 11/24/2012 06:02 PM, Liu Ping Fan wrote: >> - obj->ref--; >> >> /* parent always holds a reference to its children */ >> - if (obj->ref == 0) { >> + if (__sync_fetch_and_sub(&obj->ref, 1) == 1) { > > if (__sync_sub_and_fetch(&obj->ref, 1) == 0) > Applied, thanks > > r~