[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 1/2] add a header file for atomic operations
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH v3 1/2] add a header file for atomic operations |
Date: |
Wed, 19 Jun 2013 09:37:54 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6 |
On 06/19/2013 01:59 PM, Liu Ping Fan wrote:
> +#ifndef atomic_read
> +#define atomic_read(ptr) (*(__typeof__(*ptr) *volatile) (ptr))
> #endif
>
> +#ifndef atomic_set
> +#define atomic_set(ptr, i) ((*(__typeof__(*ptr) *volatile) (ptr)) = (i))
> +#endif
I still think these should be enhanced to reject operations larger
than word-size, so that we don't accidentally introduce bugs for our
32-bit hosts. But that can be done as a follow-up.
Otherwise, everything looks consistent now.
Reviewed-by: Richard Henderson <address@hidden>
r~