From e3b34fec6962e6deda3dd9dd83bf9fa20ab594af Mon Sep 17 00:00:00 2001
From: Brad Kittenbrink <brad@lindenlab.com>
Date: Thu, 8 Dec 2022 12:53:51 -0800
Subject: [PATCH] Fix for non-windows build of DRTVWR-559 use usleep() for
 sleepy_robin scheduler

---
 indra/llcommon/threadpool.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/indra/llcommon/threadpool.cpp b/indra/llcommon/threadpool.cpp
index b0d2016be09..1b29b8b69f4 100644
--- a/indra/llcommon/threadpool.cpp
+++ b/indra/llcommon/threadpool.cpp
@@ -37,11 +37,17 @@ struct sleepy_robin: public boost::fibers::algo::round_robin
 {
     virtual void suspend_until( std::chrono::steady_clock::time_point const&) noexcept
     {
+#if LL_WINDOWS
         // round_robin holds a std::condition_variable, and
         // round_robin::suspend_until() calls
         // std::condition_variable::wait_until(). On Windows, that call seems
         // busier than it ought to be. Try just sleeping.
         Sleep(1);
+#else
+        // currently unused other than windows, but might as well have something here
+        // different units than Sleep(), but we actually just want to sleep for any de-minimis duration
+        usleep(1);
+#endif
     }
 
     virtual void notify() noexcept
-- 
GitLab