From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56542) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b36mB-0003OB-4T for qemu-devel@nongnu.org; Wed, 18 May 2016 15:04:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b36m7-0005ic-NV for qemu-devel@nongnu.org; Wed, 18 May 2016 15:04:59 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:38510) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b36m5-0005en-44 for qemu-devel@nongnu.org; Wed, 18 May 2016 15:04:55 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 4D53920FBE for ; Wed, 18 May 2016 15:04:44 -0400 (EDT) Date: Wed, 18 May 2016 15:04:43 -0400 From: "Emilio G. Cota" Message-ID: <20160518190443.GA17967@flamenco> References: <1463196873-17737-1-git-send-email-cota@braap.org> <1463196873-17737-8-git-send-email-cota@braap.org> <573CB2A6.6070704@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <573CB2A6.6070704@gmail.com> Subject: Re: [Qemu-devel] [PATCH v5 07/18] qemu-thread: add simple test-and-set spinlock List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sergey Fedorov Cc: QEMU Developers , MTTCG Devel , Alex =?iso-8859-1?Q?Benn=E9e?= , Paolo Bonzini , Peter Crosthwaite , Richard Henderson On Wed, May 18, 2016 at 21:21:26 +0300, Sergey Fedorov wrote: > On 14/05/16 06:34, Emilio G. Cota wrote: > > +static inline int qemu_spin_trylock(QemuSpin *spin) > > +{ > > + if (atomic_test_and_set_acquire(&spin->value)) { > > + return -EBUSY; > > Seems this should be: > > return EBUSY; I don't think any caller would/should ever check this value, other than if (!trylock). It's true though that pthread_mutex_trylock returns EBUSY, so it's probably best to remain consistent with it; I've made the change. Thanks, Emilio