7 #ifndef MSynch_AtomicLong_h 8 #define MSynch_AtomicLong_h 18 #include <sys/atomic_op.h> 19 #elif defined(sun) || defined(linux) 35 long MSynch_AtomicIncrement(
long *lp);
36 long MSynch_AtomicDecrement(
long *lp);
37 long MSynch_AtomicSet(
long *lp,
long newVal);
38 long MSynch_AtomicAdd(
long *lp,
long inValue);
58 #elif defined(_AIX) || defined(sun) || defined(linux) || (defined(__hpux) ) 78 #elif defined(_AIX) || defined(sun) || defined(linux) || (defined(__hpux) ) // HP-UX only works on IA machine -hzhang 95 Int32 operator++() throw();
101 return ::fetch_and_addlp(&mnAtomicLongData, 1)+1;
103 #elif defined(sun) || defined(linux) || (defined(__hpux) ) // HP-UX only works on IA machine -hzhang 105 return __sync_fetch_and_add(&mnAtomicLongData, 1)+1;
107 return ++(mAtomicLongData);
121 return ::fetch_and_addlp(&mnAtomicLongData, inValue);
123 #elif defined(sun) || defined(linux) || (defined(__hpux) ) // HP-UX only works on IA machine -hzhang 124 return __sync_fetch_and_add(&mnAtomicLongData, inValue)+inValue;
126 return (mAtomicLongData)++;
138 Int32 operator--() throw();
144 return ::fetch_and_addlp(&mnAtomicLongData, -1)-1;
146 #elif defined(sun) || defined(linux) || (defined(__hpux) ) // HP-UX only works on IA machine -hzhang 148 return __sync_fetch_and_sub(&mnAtomicLongData, 1)-1;
151 return --(mAtomicLongData);
162 return mnAtomicLongData;
163 #elif defined(_AIX) || defined(sun) || defined(linux) || (defined(__hpux) ) 164 return mnAtomicLongData;
166 return mAtomicLongData;
176 return mnAtomicLongData;
177 #elif defined(_AIX) || defined(sun) || defined(linux) || (defined(__hpux) ) 178 return mnAtomicLongData;
180 return mAtomicLongData;
185 void operator=(
const Int32 inValue){mnAtomicLongData = 0;}
186 void operator=(
const AtomicLong& irAtomicLong){ mnAtomicLongData = irAtomicLong.mnAtomicLongData;}
187 #elif defined(_AIX) || defined(sun) || defined(linux) || (defined(__hpux) ) 188 void operator=(
const Int32 inValue){mnAtomicLongData = 0;}
189 void operator=(
const AtomicLong& irAtomicLong){ mnAtomicLongData = irAtomicLong.mnAtomicLongData;}
208 return ::InterlockedExchange(&mnAtomicLongData,inValue);
211 long retVal = mnAtomicLongData;
212 while(
FALSE == ::compare_and_swaplp(&mnAtomicLongData, &retVal, inValue))
219 #elif defined(sun) || defined(linux) || (defined(__hpux)) 222 return __sync_lock_test_and_set(&mnAtomicLongData,inValue);
229 long lPreviousValue = mAtomicLongData;
230 mAtomicLongData = inValue;
231 return lPreviousValue;
241 long mnAtomicLongData;
242 #elif defined(_AIX) || defined(sun) || defined(linux) || (defined(__hpux) ) // HP-UX only works on IA machine -hzhang 243 long mnAtomicLongData;
245 Int32 mAtomicLongData;
247 Int32 mAtomicLongData;
253 #endif // MSynch_AtomicLong_h void operator=(const AtomicLong &irAtomicLong)
Definition: AtomicLong.h:201
~AtomicLong()
Definition: AtomicLong.h:86
Int32 GetValue() const
Definition: AtomicLong.h:170
AtomicLong(const AtomicLong &irAtomicLong)
Definition: AtomicLong.h:84
#define _ASSERT(x)
Definition: Asserte.h:34
void operator=(const Int32 inValue)
Definition: AtomicLong.h:195
Definition: InprocessRecursiveMutex.h:25
Definition: ReferenceCountedImpl.h:18
Int32 Exchange(Int32 inValue)
Definition: AtomicLong.h:205
Definition: InprocessRecursiveMutex.h:31
#define Int32
Definition: BasicTypes.h:20
#define DLL_SYNCH_EXIM
Definition: Synch.h:17
Int32 operator++()
Definition: AtomicLong.h:97
Definition: AtomicLong.h:71
#define FALSE
Definition: PDCwtypes.h:54
Int32 operator--()
Definition: AtomicLong.h:140
Int32 operator+=(Int32 inValue)
Definition: AtomicLong.h:118