[rtems commit] score: Atomic flag changes
Sebastian Huber
sebh at rtems.org
Wed Aug 28 12:54:21 UTC 2013
Module: rtems
Branch: master
Commit: 03aad60a05e2aea8449e79f5b7f7f26a93878251
Changeset: http://git.rtems.org/rtems/commit/?id=03aad60a05e2aea8449e79f5b7f7f26a93878251
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Wed Aug 28 11:27:26 2013 +0200
score: Atomic flag changes
Delete _Atomic_Init_flag(). Change ATOMIC_INITIALIZER_FLAG into a
constant. Rename _Atomic_Clear_flag() to _Atomic_Flag_clear(). Rename
_Atomic_Test_set_flag() to _Atomic_Flag_test_and_set(). This is now in
line with the C11 schema.
---
cpukit/score/include/rtems/score/atomic.h | 46 ++++++++++------------
cpukit/score/include/rtems/score/cpustdatomic.h | 39 ++++---------------
2 files changed, 29 insertions(+), 56 deletions(-)
diff --git a/cpukit/score/include/rtems/score/atomic.h b/cpukit/score/include/rtems/score/atomic.h
index 2c431cc..e085dea 100644
--- a/cpukit/score/include/rtems/score/atomic.h
+++ b/cpukit/score/include/rtems/score/atomic.h
@@ -36,7 +36,11 @@ extern "C" {
*/
#define ATOMIC_INITIALIZER_UINT(value) CPU_ATOMIC_INITIALIZER_UINT(value)
#define ATOMIC_INITIALIZER_PTR(value) CPU_ATOMIC_INITIALIZER_PTR(value)
-#define ATOMIC_INITIALIZER_FLAG(value) CPU_ATOMIC_INITIALIZER_FLAG(value)
+
+/**
+ * @brief Initializes an atomic flag object to the cleared state.
+ */
+#define ATOMIC_INITIALIZER_FLAG CPU_ATOMIC_INITIALIZER_FLAG
/**
* @brief Initializes an atomic type value into a atomic object.
@@ -60,14 +64,6 @@ static inline void _Atomic_Init_ptr(
_CPU_atomic_Init_ptr(object, value);
}
-static inline void _Atomic_Init_flag(
- volatile Atomic_Flag *object,
- _Bool value
-)
-{
- _CPU_atomic_Init_flag(object, value);
-}
-
/**
* @brief Atomically load an atomic type value from atomic object.
*
@@ -293,35 +289,35 @@ static inline bool _Atomic_Compare_exchange_ptr(
}
/**
- * @brief Atomically clear the value of an atomic flag type object.
+ * @brief Atomically clears an atomic flag.
*
- * @param[in, out] object an atomic flag type pointer of object.
- * @param order a type of Atomic_Order.
+ * @param[in, out] object Pointer to the atomic flag object.
+ * @param[in] order The atomic memory order.
*
*/
-static inline void _Atomic_Clear_flag(
- volatile Atomic_Flag *object,
- Atomic_Order order
+static inline void _Atomic_Flag_clear(
+ volatile Atomic_Flag *object,
+ Atomic_Order order
)
{
- _CPU_atomic_Clear_flag( object, order );
+ _CPU_atomic_Flag_clear( object, order );
}
/**
- * @brief Atomically test and clear the value of an atomic flag type object.
+ * @brief Atomically tests and sets an atomic flag.
*
- * @param[in, out] object an atomic flag type pointer of object.
- * @param order a type of Atomic_Order.
+ * @param[in, out] object Pointer to the atomic flag object.
+ * @param[in] order The atomic memory order.
*
- * @retval true if the test and set successully.
- * @retval false if the test and set failed.
+ * @retval true The atomic flag was already set.
+ * @retval false Otherwise.
*/
-static inline bool _Atomic_Test_set_flag(
- volatile Atomic_Flag *object,
- Atomic_Order order
+static inline bool _Atomic_Flag_test_and_set(
+ volatile Atomic_Flag *object,
+ Atomic_Order order
)
{
- return _CPU_atomic_Test_set_flag( object, order );
+ return _CPU_atomic_Flag_test_and_set( object, order );
}
#ifdef __cplusplus
diff --git a/cpukit/score/include/rtems/score/cpustdatomic.h b/cpukit/score/include/rtems/score/cpustdatomic.h
index 47f9195..6ec5828 100644
--- a/cpukit/score/include/rtems/score/cpustdatomic.h
+++ b/cpukit/score/include/rtems/score/cpustdatomic.h
@@ -73,7 +73,8 @@ typedef enum {
*/
#define CPU_ATOMIC_INITIALIZER_UINT(value) ATOMIC_VAR_INIT(value)
#define CPU_ATOMIC_INITIALIZER_PTR(value) ATOMIC_VAR_INIT(value)
-#define CPU_ATOMIC_INITIALIZER_FLAG(value) ATOMIC_VAR_INIT(value)
+
+#define CPU_ATOMIC_INITIALIZER_FLAG ATOMIC_FLAG_INIT
/**
* @brief Initializes an atomic type value into a atomic object.
@@ -97,14 +98,6 @@ static inline void _CPU_atomic_Init_ptr(
atomic_init(object, value);
}
-static inline void _CPU_atomic_Init_flag(
- volatile Atomic_Flag *object,
- _Bool value
-)
-{
- atomic_init(object, value);
-}
-
/**
* @brief Atomically load an atomic type value from atomic object.
*
@@ -329,33 +322,17 @@ static inline bool _CPU_atomic_Compare_exchange_ptr(
new_value, order_succ, order_fail );
}
-/**
- * @brief Atomically clear the value of an atomic flag type object.
- *
- * @param[in, out] object an atomic flag type pointer of object.
- * @param order a type of Atomic_Order.
- *
- */
-static inline void _CPU_atomic_Clear_flag(
- volatile Atomic_Flag *object,
- Atomic_Order order
+static inline void _CPU_atomic_Flag_clear(
+ volatile Atomic_Flag *object,
+ Atomic_Order order
)
{
return atomic_flag_clear_explicit( object, order );
}
-/**
- * @brief Atomically test and clear the value of an atomic flag type object.
- *
- * @param[in, out] object an atomic flag type pointer of object.
- * @param order a type of Atomic_Order.
- *
- * @retval true if the test and set successully.
- * @retval false if the test and set failed.
- */
-static inline bool _CPU_atomic_Test_set_flag(
- volatile Atomic_Flag *object,
- Atomic_Order order
+static inline bool _CPU_atomic_Flag_test_and_set(
+ volatile Atomic_Flag *object,
+ Atomic_Order order
)
{
return atomic_flag_test_and_set_explicit( object, order );
More information about the vc
mailing list