<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">From b3d75a642177f21f00d18f0e46bca4a9f363d08e Mon Sep 17 00:00:00 2001
From: Rosen Penev &lt;rosenp@gmail.com&gt;
Date: Fri, 23 Aug 2019 13:35:28 -0700
Subject: [PATCH] Replace usleep with C++11 sleep_for

usleep was deprecated with POSIX 2008 and optionally unavailable with
uClibc-ng.
---
 src/thread_base.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/src/thread_base.cc
+++ b/src/thread_base.cc
@@ -42,6 +42,8 @@
 #include &lt;cstdlib&gt;
 #include &lt;cstring&gt;
 #include &lt;iostream&gt;
+#include &lt;chrono&gt;
+#include &lt;thread&gt;
 #include &lt;signal.h&gt;
 #include &lt;unistd.h&gt;
 #include &lt;rak/error_number.h&gt;
@@ -66,7 +68,7 @@ public:
 
   thread_queue_hack() { std::memset(this, 0, sizeof(thread_queue_hack)); }
 
-  void     lock()   { while (!__sync_bool_compare_and_swap(&amp;m_lock, 0, 1)) usleep(0); }
+  void     lock()   { while (!__sync_bool_compare_and_swap(&amp;m_lock, 0, 1)) std::this_thread::sleep_for(std::chrono::microseconds(0)); }
   void     unlock() { __sync_bool_compare_and_swap(&amp;m_lock, 1, 0); }
 
   iterator begin() { return m_queue; }
</pre></body></html>