 |
OpendTect
6.6
|
Go to the documentation of this file.
14 #include "odversion.h"
37 {
return std::atomic<T>::load(); }
83 bool operator!()
const {
return !std::atomic<T*>::load(); }
84 operator bool()
const {
return std::atomic<T*>::load();}
87 const T*
operator->()
const {
return std::atomic<T*>::load(); }
133 int count()
const {
return count_; }
167 int count()
const {
return count_; }
181 if ( oldval>=newval )
184 while ( !setIfValueIs( oldval, newval, &oldval ) );
193 if ( oldval<=newval )
196 while ( !setIfValueIs( oldval, newval, &oldval ) );
200 template <
class T>
inline
202 :
std::atomic<T>( val )
206 template <
class T>
inline
212 template <
class T>
inline
217 template <
class T>
inline
219 { std::atomic<T>::store(nv);
return *
this; }
222 template <
class T>
inline
224 { std::atomic<T>::store(nv);
return *
this; }
227 template <
class T>
inline
230 T presumedval = curval;
231 if ( !this->compare_exchange_strong(presumedval,newval) )
234 *actualvalptr = presumedval;
244 template <
class T>
inline
246 :
std::atomic<T*>( newptr )
250 template <
class T>
inline
253 T* curval =
const_cast<T*
>( oldptr );
254 return this->compare_exchange_strong( curval, newptr );
258 template <
class T>
inline
261 return std::atomic<T*>::exchange( 0 );
265 template <
class T>
inline
268 std::atomic<T*>::store( ptr );
273 template <
class T>
inline
276 return operator=(
sCast(T*,ptr) );
void setIfLarger(T newval)
Definition: atomic.h:176
Atomic instantiated with a pointer. The class really only handles the casting from a void* to a T*.
Definition: atomic.h:70
AtomicPointer(T *newptr=0)
Definition: atomic.h:245
Threads::Atomic< DirtyCountType > DirtyCounter
Definition: atomic.h:282
Atomic(T val=0)
Definition: atomic.h:201
#define mGlobal(module)
Definition: commondefs.h:180
Atomic< int > count_
Definition: atomic.h:129
bool recursive_
Definition: atomic.h:130
#define mExpClass(module)
Definition: commondefs.h:177
#define sCast(tp, v)
Definition: commondefs.h:141
AtomicPointer< T > & operator=(const AtomicPointer< T > &)
Definition: atomic.h:274
Atomic(const Atomic< T > &)
Definition: atomic.h:207
T * operator->()
Definition: atomic.h:86
Is an alternative to Mutex. It is a lock which causes a thread trying to acquire it to simply wait in...
Definition: atomic.h:108
Atomic< T > & operator=(const Atomic< T > &)
Definition: atomic.h:223
Atomic< void * > lockingthread_
Definition: atomic.h:126
int count() const
Definition: atomic.h:133
Atomic< int > count_
Definition: atomic.h:164
#define mClass(module)
Definition: commondefs.h:181
#define mDeprecated(msg)
Definition: plfdefs.h:215
Atomic< T > & operator=(T nv)
Definition: atomic.h:218
bool atomicSetIfValueIs(volatile int &val, int curval, int newval, int *actualvalptr)
bool setIfEqual(const T *curptr, T *newptr)
Definition: atomic.h:251
AtomicPointer< T > & operator=(T *ptr)
Definition: atomic.h:266
~Atomic()
Definition: atomic.h:213
int count() const
Definition: atomic.h:167
Definition: fixedstreambuf.h:20
SpinLock(const SpinLock &)
SpinLock & operator=(const SpinLock &b)
Definition: atomic.h:118
bool operator!() const
Definition: atomic.h:83
const T * operator->() const
Definition: atomic.h:87
bool setIfValueIs(T curval, T newval, T *actualvalptr=0)
Definition: atomic.h:228
Is an alternative to ReadWriteLock. It is a lock which causes a thread trying to acquire it to simply...
Definition: atomic.h:147
AtomicPointer(const AtomicPointer< T > &)=delete
T * setToNull()
Definition: atomic.h:259
SpinRWLock(const SpinRWLock &)
void setIfSmaller(T newval)
Definition: atomic.h:188
interface to threads that should be portable.
Definition: atomic.h:23
SpinLock(bool recursive=false)
Generated at
for the OpendTect
seismic interpretation project.
Copyright (C): dGB Beheer B.V. 1995-2021