Date: Fri, 14 Oct 2005 12:32:13 +0200 From: Jeremie Le Hen <jeremie@le-hen.org> To: Denis Antrushin <DAntrushin@mail.ru> Cc: freebsd-current@freebsd.org Subject: Re: ufsstat - testers / feedback wanted! Message-ID: <20051014103213.GF14063@obiwan.tataz.chchile.org> In-Reply-To: <434F7BB3.5020808@mail.ru> 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>
next in thread | previous in thread | raw e-mail | index | archive | help
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 >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051014103213.GF14063>