diff --git a/src/thread_base.cc b/src/thread_base.cc index 081791d4c..ac48209f8 100644 --- a/src/thread_base.cc +++ b/src/thread_base.cc @@ -42,6 +42,8 @@ #include #include #include +#include +#include #include #include #include @@ -66,7 +68,7 @@ class lt_cacheline_aligned thread_queue_hack { thread_queue_hack() { std::memset(this, 0, sizeof(thread_queue_hack)); } - void lock() { while (!__sync_bool_compare_and_swap(&m_lock, 0, 1)) usleep(0); } + void lock() { while (!__sync_bool_compare_and_swap(&m_lock, 0, 1)) std::this_thread::sleep_for(std::chrono::microseconds(0); } void unlock() { __sync_bool_compare_and_swap(&m_lock, 1, 0); } iterator begin() { return m_queue; }