3 //=============================================================================
5 * @file Atomic_Op_GCC_T.h
7 * @author Johnny Willemsen <jwillemsen@remedy.nl
9 //=============================================================================
11 #ifndef ACE_ATOMIC_OP_GCC_T_H
12 #define ACE_ATOMIC_OP_GCC_T_H
13 #include /**/ "ace/pre.h"
15 #include /**/ "ace/config-all.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #include "ace/Thread_Mutex.h"
22 #include "ace/ACE_export.h"
24 #if defined (ACE_HAS_GCC_ATOMIC_BUILTINS) && (ACE_HAS_GCC_ATOMIC_BUILTINS == 1)
26 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
29 * @brief Specialization of ACE_Atomic_Op for platforms that
30 * support atomic integer operations.
32 * Specialization of ACE_Atomic_Op for platforms that support atomic
36 class ACE_Export ACE_Atomic_Op_GCC
39 /// Atomically pre-increment @c value_.
42 /// Atomically post-increment @c value_.
45 /// Atomically increment @c value_ by rhs.
48 /// Atomically pre-decrement @c value_.
51 /// Atomically post-decrement @c value_.
54 /// Atomically decrement @c value_ by rhs.
57 /// Atomically compare @c value_ with rhs.
58 bool operator== (T rhs
) const;
60 /// Atomically compare @c value_ with rhs.
61 bool operator!= (T rhs
) const;
63 /// Atomically check if @c value_ greater than or equal to rhs.
64 bool operator>= (T rhs
) const;
66 /// Atomically check if @c value_ greater than rhs.
67 bool operator> (T rhs
) const;
69 /// Atomically check if @c value_ less than or equal to rhs.
70 bool operator<= (T rhs
) const;
72 /// Atomically check if @c value_ less than rhs.
73 bool operator< (T rhs
) const;
75 /// Exchange value with @a newval.
76 T
exchange (T newval
);
78 /// Explicitly return @c value_.
81 /// Dump the state of an object.
84 /// Explicitly return @c value_ (by reference).
85 volatile T
&value_i ();
87 // ACE_ALLOC_HOOK_DECLARE;
88 // Declare the dynamic allocation hooks.
91 /// Atomically assign rhs to @c value_.
92 ACE_Atomic_Op_GCC
<T
> &operator= (T rhs
);
94 /// Atomically assign <rhs> to @c value_.
95 ACE_Atomic_Op_GCC
<T
> &operator= (const ACE_Atomic_Op_GCC
<T
> &rhs
);
97 /// Initialize @c value_ to 0.
100 /// Initialize @c value_ to c.
101 ACE_Atomic_Op_GCC (T c
);
103 /// Manage copying...
104 ACE_Atomic_Op_GCC (const ACE_Atomic_Op_GCC
<T
> &c
);
107 // This function cannot be supported by this template specialization.
108 // If you need access to an underlying lock, use the ACE_Atomic_Op_Ex
110 ACE_Thread_Mutex
&mutex ();
113 /// Current object decorated by the atomic op.
117 ACE_END_VERSIONED_NAMESPACE_DECL
119 #if defined (__ACE_INLINE__)
120 #include "ace/Atomic_Op_GCC_T.inl"
121 #endif /* __ACE_INLINE__ */
123 #include "ace/Atomic_Op_GCC_T.cpp"
125 #endif /* ACE_HAS_GCC_ATOMIC_BUILTINS */
127 #include /**/ "ace/post.h"
128 #endif /*ACE_ATOMIC_OP_GCC_T_H*/