Mesa (master): pipe: Get the p_atomic_dec_zero logic right this time.

Michał Król michal at vmware.com
Tue Apr 21 09:52:22 UTC 2009


Jose Fonseca pisze:
> Module: Mesa
> Branch: master
> Commit: 86ed894e47bae10d158f2b4a02065daa9dbe5194
> URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=86ed894e47bae10d158f2b4a02065daa9dbe5194
>
> Author: José Fonseca <jfonseca at vmware.com>
> Date:   Fri Apr 17 18:40:46 2009 +0100
>
> pipe: Get the p_atomic_dec_zero logic right this time.
>
> ---
>
>  src/gallium/include/pipe/p_atomic.h |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/include/pipe/p_atomic.h b/src/gallium/include/pipe/p_atomic.h
> index ed5f665..0c3fbae 100644
> --- a/src/gallium/include/pipe/p_atomic.h
> +++ b/src/gallium/include/pipe/p_atomic.h
> @@ -225,7 +225,7 @@ p_atomic_cmpxchg(struct pipe_atomic *v, int32_t old, int32_t _new)
>  
>  struct pipe_atomic
>  {
> -   long count;
> +   volatile long count;
>  };
>  

Jose,

Could you explain why the `volatile' keyword above is necessary? We are 
using InterlockedDecrement/Increment() functions to operate on it, and I 
believe any function call should be a sufficient memory barrier.



More information about the mesa-commit mailing list