16 #ifdef MRPT_OS_WINDOWS
18 #elif defined( __clang__ ) && defined( MRPT_OS_APPLE )
20 #elif defined( __GNUC__ )
21 #if ( __GNUC__ * 100 + __GNUC_MINOR__ >= 402 )
22 # include <ext/atomicity.h>
24 # include <bits/atomicity.h>
27 #error This is not Windows and compiler is not GCC: Non implemented atomic_incr for this case
31 #ifdef MRPT_OS_WINDOWS
39 return InterlockedDecrement(&
m_value);
44 return static_cast<long const volatile &
>(
m_value );
49 #if ( defined( __i386__ ) || defined( __x86_64__ ) )
62 int my_atomic_exchange_and_add(
int * pw,
int dv )
72 "+m"( *pw ),
"=r"(
r ):
81 return my_atomic_exchange_and_add( &
m_value, -1 ) - 1;
86 return my_atomic_exchange_and_add( &
m_value, 0 );
90 #if defined(__GLIBCXX__)
91 using __gnu_cxx::__atomic_add;
92 using __gnu_cxx::__exchange_and_add;
102 return __exchange_and_add(&
m_value, -1) - 1;
107 return __exchange_and_add(&
m_value, 0);
atomic_num_t operator--()
Atomic decrement of value and return new value.
void operator++()
Atomic increment of value.
GLdouble GLdouble GLdouble r
This namespace provides multitask, synchronization utilities.