← Back to team overview

maria-discuss team mailing list archive

Re: my_atomic_add64

 

Oleg Tsarev <zabivator@xxxxxxxxx> writes:

> I need my_atomic_add64 in mysql.
>
> Can i simple add following macros, or i need more advanced tricks?
>
> tsarev@main:/storage/project/percona/rtd_2$ diff -Nur
> ../rtd/c/include/my_atomic.h c/include/my_atomic.h
> --- ../rtd/c/include/my_atomic.h        2010-07-09 16:35:11.000000000 +0400
> +++ c/include/my_atomic.h       2010-08-17 18:57:07.648819066 +0400

I think you'll also need

    make_transparent_unions(32)
    #define U_32   int32
    #define Uv_32  int32


> @@ -96,25 +96,30 @@
>  make_atomic_cas( 8)
>  make_atomic_cas(16)
>  make_atomic_cas(32)
> +make_atomic_cas(64)
>  make_atomic_cas(ptr)

> ...

My guess is it should work, at least on 64-bit platforms.

I'm not sure that 32-bit CPUs generally provide 64-bit atomic operations. If
not (which seems likely, really), you'll need to come up with something to
handle this case. Note that the my_atomic stuff has the possibility to
fallback to mutex locking when support is not available, so one way might be
to make it use this fallback on 32-bit (taking a performance penalty, but
32-bit is getting less and less interesting by the day anyway).

 - Kristian.



Follow ups

References