34 #ifndef _GLIBCXX_PARALLEL_COMPATIBILITY_H
35 #define _GLIBCXX_PARALLEL_COMPATIBILITY_H 1
40 #if !defined(_WIN32) || defined (__CYGWIN__)
49 __attribute((dllimport)) void __attribute__((stdcall)) Sleep (
unsigned long);
52 namespace __gnu_parallel
54 template<
typename _Tp>
56 __add_omp(
volatile _Tp* __ptr, _Tp __addend)
72 template<
typename _Tp>
76 if (__atomic_always_lock_free(
sizeof(_Tp), __ptr))
77 return __atomic_fetch_add(__ptr, __addend, __ATOMIC_ACQ_REL);
78 return __add_omp(__ptr, __addend);
81 template<
typename _Tp>
83 __cas_omp(
volatile _Tp* __ptr, _Tp __comparand, _Tp __replacement)
88 if (*__ptr == __comparand)
90 *__ptr = __replacement;
106 template<
typename _Tp>
110 if (__atomic_always_lock_free(
sizeof(_Tp), __ptr))
111 return __atomic_compare_exchange_n(__ptr, &__comparand, __replacement,
112 false, __ATOMIC_ACQ_REL,
114 return __cas_omp(__ptr, __comparand, __replacement);
123 #if defined (_WIN32) && !defined (__CYGWIN__)
Sequential helper functions. This file is a GNU parallel extension to the Standard C++ Library...
bool __compare_and_swap(volatile _Tp *__ptr, _Tp __comparand, _Tp __replacement)
Compare-and-swap.
void __yield()
Yield control to another thread, without waiting for the end of the time slice.
Basic types and typedefs. This file is a GNU parallel extension to the Standard C++ Library...
_Tp __fetch_and_add(volatile _Tp *__ptr, _Tp __addend)
Add a value to a variable, atomically.