From owner-freebsd-current@FreeBSD.ORG Fri Oct 14 10:32:27 2005 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D3B0916A41F for ; Fri, 14 Oct 2005 10:32:27 +0000 (GMT) (envelope-from tataz@tataz.chchile.org) Received: from smtp5-g19.free.fr (smtp5-g19.free.fr [212.27.42.35]) by mx1.FreeBSD.org (Postfix) with ESMTP id 70F9943D45 for ; Fri, 14 Oct 2005 10:32:27 +0000 (GMT) (envelope-from tataz@tataz.chchile.org) Received: from tatooine.tataz.chchile.org (vol75-8-82-233-239-98.fbx.proxad.net [82.233.239.98]) by smtp5-g19.free.fr (Postfix) with ESMTP id 0084A9453; Fri, 14 Oct 2005 12:32:25 +0200 (CEST) Received: by tatooine.tataz.chchile.org (Postfix, from userid 1000) id 0B582405A; Fri, 14 Oct 2005 12:32:14 +0200 (CEST) Date: Fri, 14 Oct 2005 12:32:13 +0200 From: Jeremie Le Hen To: Denis Antrushin Message-ID: <20051014103213.GF14063@obiwan.tataz.chchile.org> References: <434E46C0.7060903@centtech.com> <200510131412.23525.max@love2party.net> <20051013181026.GB27418@odin.ac.hmc.edu> <20051014091004.GC18513@uk.tiscali.com> <434F7BB3.5020808@mail.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <434F7BB3.5020808@mail.ru> User-Agent: Mutt/1.5.10i Cc: freebsd-current@freebsd.org Subject: Re: ufsstat - testers / feedback wanted! X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2005 10:32:27 -0000 Hi, > >I'd be grateful if you could clarify that point for me. Are you saying that > >if I write > > > > long long foo; > > ... > > foo++; > > > >then the C compiler generates code for 'foo++' which is not thread-safe? > >(And therefore I would have to protect it with a mutex or critical section) > > Yes. On 32-bit it looks something like that: > > cltd > movl $1 %eax > movl $0, %edx > addl -16(%ebp), %eax > adcl -12(%ebp), %edx > movl %eax, -16(%ebp) > movl %edx, -12(%ebp) I'm not sure about it but I bet there are some macro for this kind of thing in order to use a mutex only when necessary (IOW, on archs that don't support 64bits natively). Am I right, and in this case what are those macros ? Regards, -- Jeremie Le Hen < jeremie at le-hen dot org >< ttz at chchile dot org >