[PATCH 1/4] modify the atomic API to be compatible with C11 stdatomic.h
Gedare Bloom
gedare at rtems.org
Mon Jun 24 13:20:58 UTC 2013
I have one specific comment below, and a couple small questions:
* What are the new types from for example atomic_xxx
* Why do we still keep the old types (Atomic_Xxx) in some cases but
replaced in others by standard types? Would it be simpler to just use
standard types?
> diff --git a/cpukit/score/include/rtems/score/genericcpuatomic.h b/cpukit/score/include/rtems/score/genericcpuatomic.h
> index 2599d0d..ed5868a 100644
> --- a/cpukit/score/include/rtems/score/genericcpuatomic.h
> +++ b/cpukit/score/include/rtems/score/genericcpuatomic.h
> @@ -16,6 +16,7 @@
> #define _RTEMS_SCORE_GEMERAL_ATOMIC_CPU_H
>
> #include <stdint.h>
> +#include <stdatomic.h>
>
> #ifdef __cplusplus
> extern "C" {
> @@ -31,27 +32,37 @@ extern "C" {
> /**
> * @brief atomic operation unsigned integer type
> */
> -typedef unsigned int Atomic_Int;
> +//typedef unsigned int Atomic_Int;
> +//typedef _Atomic(unsigned int) Atomic_Int;
> +typedef atomic_uint Atomic_Int;
>
Is there a reason to keep the commented out lines here and below, or
can they be deleted?
> /**
> * @brief atomic operation unsigned long integer type
> */
> -typedef unsigned long Atomic_Long;
> +//typedef unsigned long Atomic_Long;
> +//typedef _Atomic(unsigned long) Atomic_Long;
> +typedef atomic_ulong Atomic_Long;
>
> /**
> * @brief atomic operation unsigned 32-bit integer type
> */
> -typedef uint32_t Atomic_Int32;
> +//typedef uint32_t Atomic_Int32;
> +//typedef _Atomic(uint32_t) Atomic_Int32;
> +typedef atomic_uint_least32_t Atomic_Int32;
>
> /**
> * @brief atomic operation unsigned 64-bit integer type
> */
> -typedef uint64_t Atomic_Int64;
> +//typedef uint64_t Atomic_Int64;
> +//typedef _Atomic(uint64_t) Atomic_Int64;
> +typedef atomic_uint_least64_t Atomic_Int64;
>
> /**
> * @brief atomic operation unsigned integer the size of a pointer type
> */
> -typedef uintptr_t Atomic_Pointer;
> +//typedef uintptr_t Atomic_Pointer;
> +//typedef _Atomic(uintptr_t) Atomic_Pointer;
> +typedef atomic_uintptr_t Atomic_Pointer;
>
> #ifdef __cplusplus
> }
More information about the devel
mailing list