Re: ufsstat - testers / feedback wanted!

From: Jeremie Le Hen <jeremie_at_le-hen.org>
Date: Fri, 14 Oct 2005 12:32:13 +0200
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 >
Received on Fri Oct 14 2005 - 08:32:27 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:45 UTC