diff --git a/cpp/particles/lock_free_bool_array.hpp b/cpp/particles/lock_free_bool_array.hpp index 699885aab7fad66622c0c8ae62987336b9c5a006..028191479d5539efe7487c6b88262d5cbceeb135 100644 --- a/cpp/particles/lock_free_bool_array.hpp +++ b/cpp/particles/lock_free_bool_array.hpp @@ -68,7 +68,11 @@ public: if(k->ownerId.load() != omp_get_thread_num()){ int localBusy = Busy;// Intel complains if we pass a const as last param int expected = Available; +#ifdef __INTEL_COMPILER + while(!__sync_val_compare_and_swap(&k->lock, &expected, localBusy)){ +#else while(!std::atomic_compare_exchange_strong(&k->lock, &expected, localBusy)){ +#endif usleep(1); expected = Available; }