Currently we are using proprietary code here
|
#ifdef __GNUC__ |
|
#if !defined WIN32 && (defined __i486__ || defined __i586__ || defined __i686__ || defined __MMX__ || defined __SSE__ || defined __ppc__) |
|
#define CV_XADD __sync_fetch_and_add |
|
#else |
|
#include <ext/atomicity.h> |
|
#define CV_XADD __gnu_cxx::__exchange_and_add |
|
#endif |
|
#elif defined WIN32 || defined _WIN32 |
|
#include <intrin.h> |
|
#define CV_XADD(addr,delta) _InterlockedExchangeAdd((long volatile*)(addr), (delta)) |
|
#else |
|
|
|
template<typename _Tp> static inline _Tp CV_XADD(_Tp* addr, _Tp delta) |
|
{ int tmp = *addr; *addr += delta; return tmp; } |
|
|
|
#endif |
I don't know why there is a thread-safety reference counter, but we can replace CV_XADD by atomic operations of C++11 (I believe atomic_fetch_add should fit)
Currently we are using proprietary code here
pcl/gpu/containers/src/device_memory.cpp
Lines 79 to 94 in 7118b62
I don't know why there is a thread-safety reference counter, but we can replace
CV_XADDby atomic operations of C++11 (I believe atomic_fetch_add should fit)