Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Atomic_Op.i

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // $Id: Atomic_Op.i,v 1.1.1.3 2003/02/21 18:36:32 chad Exp $
00003 
00004 
00005 #if defined (ACE_HAS_BUILTIN_ATOMIC_OP)
00006 
00007 ACE_INLINE
00008 ACE_Atomic_Op<ACE_Thread_Mutex, long>::ACE_Atomic_Op (void)
00009   : value_ (0)
00010 {
00011 }
00012 
00013 ACE_INLINE
00014 ACE_Atomic_Op<ACE_Thread_Mutex, long>::ACE_Atomic_Op (long c)
00015   : value_ (c)
00016 {
00017 }
00018 
00019 ACE_INLINE
00020 ACE_Atomic_Op<ACE_Thread_Mutex, long>::ACE_Atomic_Op (const ACE_Atomic_Op<ACE_Thread_Mutex, long> &rhs)
00021   : value_ (rhs.value_)
00022 {
00023 }
00024 
00025 ACE_INLINE long
00026 ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator++ (void)
00027 {
00028 #if defined (WIN32)
00029   return ::InterlockedIncrement (ACE_const_cast (long *, &this->value_));
00030 #else /* WIN32 */
00031   return (*increment_fn_) (&this->value_);
00032 #endif /* WIN32 */
00033 }
00034 
00035 ACE_INLINE long
00036 ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator++ (int)
00037 {
00038 #if defined (WIN32)
00039   return ::InterlockedIncrement (ACE_const_cast (long *, &this->value_)) - 1;
00040 #else /* WIN32 */
00041   return (*increment_fn_) (&this->value_) - 1;
00042 #endif /* WIN32 */
00043 }
00044 
00045 ACE_INLINE long
00046 ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator-- (void)
00047 {
00048 #if defined (WIN32)
00049   return ::InterlockedDecrement (ACE_const_cast (long *, &this->value_));
00050 #else /* WIN32 */
00051   return (*decrement_fn_) (&this->value_);
00052 #endif /* WIN32 */
00053 }
00054 
00055 ACE_INLINE long
00056 ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator-- (int)
00057 {
00058 #if defined (WIN32)
00059   return ::InterlockedDecrement (ACE_const_cast (long *, &this->value_)) + 1;
00060 #else /* WIN32 */
00061   return (*decrement_fn_) (&this->value_) + 1;
00062 #endif /* WIN32 */
00063 }
00064 
00065 ACE_INLINE long
00066 ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator+= (long rhs)
00067 {
00068 #if defined (WIN32) && defined (ACE_HAS_INTERLOCKED_EXCHANGEADD)
00069   return ::InterlockedExchangeAdd (ACE_const_cast (long *, &this->value_), rhs) + rhs;
00070 #else /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */
00071   return (*exchange_add_fn_) (&this->value_, rhs) + rhs;
00072 #endif /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */
00073 }
00074 
00075 ACE_INLINE long
00076 ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator-= (long rhs)
00077 {
00078 #if defined (WIN32) && defined (ACE_HAS_INTERLOCKED_EXCHANGEADD)
00079   return ::InterlockedExchangeAdd (ACE_const_cast (long *, &this->value_), -rhs) - rhs;
00080 #else /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */
00081   return (*exchange_add_fn_) (&this->value_, -rhs) - rhs;
00082 #endif /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */
00083 }
00084 
00085 ACE_INLINE int
00086 ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator== (long rhs) const
00087 {
00088   return (this->value_ == rhs);
00089 }
00090 
00091 ACE_INLINE int
00092 ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator!= (long rhs) const
00093 {
00094   return (this->value_ != rhs);
00095 }
00096 
00097 ACE_INLINE int
00098 ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator>= (long rhs) const
00099 {
00100   return (this->value_ >= rhs);
00101 }
00102 
00103 ACE_INLINE int
00104 ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator> (long rhs) const
00105 {
00106   return (this->value_ > rhs);
00107 }
00108 
00109 ACE_INLINE int
00110 ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator<= (long rhs) const
00111 {
00112   return (this->value_ <= rhs);
00113 }
00114 
00115 ACE_INLINE int
00116 ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator< (long rhs) const
00117 {
00118   return (this->value_ < rhs);
00119 }
00120 
00121 ACE_INLINE void
00122 ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator= (long rhs)
00123 {
00124   this->value_ = rhs;
00125 }
00126 
00127 ACE_INLINE void
00128 ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator= (const ACE_Atomic_Op<ACE_Thread_Mutex, long> &rhs)
00129 {
00130   this->value_ = rhs.value_;
00131 }
00132 
00133 ACE_INLINE long
00134 ACE_Atomic_Op<ACE_Thread_Mutex, long>::value (void) const
00135 {
00136   return this->value_;
00137 }
00138 
00139 ACE_INLINE volatile long &
00140 ACE_Atomic_Op<ACE_Thread_Mutex, long>::value_i (void)
00141 {
00142   return this->value_;
00143 }
00144 
00145 #endif /* ACE_HAS_BUILTIN_ATOMIC_OP */

Generated on Mon Jun 16 11:19:10 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002