21 #if (__cplusplus < 201103) || defined(__SUNPRO_CC) // Still no support for atomic... 39 #if !defined(NO_INLINE) 40 #pragma inline_depth(255) 41 #define NO_INLINE __declspec(noinline) 42 #define INLINE __forceinline 43 #define inline __forceinline 44 #endif // !defined(NO_INLINE) 48 #endif // defined(_MSC_VER) 51 #if defined(_WIN32) && !defined(_WIN64) 54 #define _WIN32_WINNT 0x0500 93 std::atomic<bool> _mutex;
104 if (_mutex.exchange(
true)) {
109 inline bool didLock() {
110 return !_mutex.exchange(
true);
121 const int MAX_SPIN = 1000;
123 if (!_mutex.exchange(
true)) {
127 while (_mutex && (count < MAX_SPIN)) {
131 if (count == MAX_SPIN) {
139 static CPUInfo cpuInfo;
140 return (cpuInfo.getNumProcessors() > 1);
146 #elif defined(__SVR4) 162 #endif // _SPINLOCK_H_
void yieldProcessor(void)
int count(int &result, const cub_regex_object ®, const std::string &src, const int position, const INTL_CODESET codeset)
bool onMultiprocessor(void)
NO_INLINE void contendedLock()