From 746788e78901835aeb3ba983840092ce97b257da Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Tue, 16 Jan 2024 16:46:34 +0200 Subject: Revert "replaces parts of boost to C++ standard." --- indra/llcommon/llcond.h | 1 + indra/llcommon/llcoros.h | 14 +++++++++----- indra/llcommon/lleventcoro.cpp | 6 +++--- indra/llcommon/llthreadsafequeue.h | 9 ++++++--- indra/llcommon/workqueue.cpp | 1 + indra/llmessage/message.h | 1 + 6 files changed, 21 insertions(+), 11 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llcond.h b/indra/llcommon/llcond.h index a4bec124ca..da6e6affe1 100644 --- a/indra/llcommon/llcond.h +++ b/indra/llcommon/llcond.h @@ -16,6 +16,7 @@ #include "llunits.h" #include "llcoros.h" +#include LLCOROS_MUTEX_HEADER #include "mutex.h" #include diff --git a/indra/llcommon/llcoros.h b/indra/llcommon/llcoros.h index 8160b87f23..966ce03296 100644 --- a/indra/llcommon/llcoros.h +++ b/indra/llcommon/llcoros.h @@ -41,6 +41,10 @@ #include #include +// e.g. #include LLCOROS_MUTEX_HEADER +#define LLCOROS_MUTEX_HEADER +#define LLCOROS_CONDVAR_HEADER + namespace boost { namespace fibers { class mutex; @@ -285,17 +289,17 @@ public: * proxy, so continue using the aliases. */ template - using Promise = std::promise; + using Promise = boost::fibers::promise; template - using Future = std::future; + using Future = boost::fibers::future; template static Future getFuture(Promise& promise) { return promise.get_future(); } // use mutex, lock, condition_variable suitable for coroutines - using Mutex = std::mutex; + using Mutex = boost::fibers::mutex; using LockType = std::unique_lock; - using cv_status = std::cv_status; - using ConditionVariable = std::condition_variable; + using cv_status = boost::fibers::cv_status; + using ConditionVariable = boost::fibers::condition_variable; /// for data local to each running coroutine template diff --git a/indra/llcommon/lleventcoro.cpp b/indra/llcommon/lleventcoro.cpp index 97a7ad04ad..067b5e6fbc 100644 --- a/indra/llcommon/lleventcoro.cpp +++ b/indra/llcommon/lleventcoro.cpp @@ -285,7 +285,7 @@ LLSD llcoro::postAndSuspendWithTimeout(const LLSD& event, // declare the future LLCoros::Future future = LLCoros::getFuture(promise); // wait for specified timeout - std::future_status status; + boost::fibers::future_status status; { LLCoros::TempStatus st(STRINGIZE("waiting for " << replyPump.getPump().getName() << " for " << timeout << "s")); @@ -296,7 +296,7 @@ LLSD llcoro::postAndSuspendWithTimeout(const LLSD& event, status = future.wait_for(std::chrono::milliseconds(long(timeout * 1000))); } // if the future is NOT yet ready, return timeoutResult instead - if (status == std::future_status::timeout) + if (status == boost::fibers::future_status::timeout) { LL_DEBUGS("lleventcoro") << "postAndSuspendWithTimeout(): coroutine " << listenerName << " timed out after " << timeout << " seconds," @@ -305,7 +305,7 @@ LLSD llcoro::postAndSuspendWithTimeout(const LLSD& event, } else { - llassert_always(status == std::future_status::ready); + llassert_always(status == boost::fibers::future_status::ready); // future is now ready, no more waiting LLSD value(future.get()); diff --git a/indra/llcommon/llthreadsafequeue.h b/indra/llcommon/llthreadsafequeue.h index 0aa75c9b73..f396a71e6f 100644 --- a/indra/llcommon/llthreadsafequeue.h +++ b/indra/llcommon/llthreadsafequeue.h @@ -28,6 +28,9 @@ #define LL_LLTHREADSAFEQUEUE_H #include "llcoros.h" +#include LLCOROS_MUTEX_HEADER +#include +#include LLCOROS_CONDVAR_HEADER #include "llexception.h" #include "mutex.h" #include @@ -179,10 +182,10 @@ protected: size_t mCapacity; bool mClosed; - std::timed_mutex mLock; + boost::fibers::timed_mutex mLock; typedef std::unique_lock lock_t; - std::condition_variable_any mCapacityCond; - std::condition_variable_any mEmptyCond; + boost::fibers::condition_variable_any mCapacityCond; + boost::fibers::condition_variable_any mEmptyCond; enum pop_result { EMPTY, DONE, WAITING, POPPED }; // implementation logic, suitable for passing to tryLockUntil() diff --git a/indra/llcommon/workqueue.cpp b/indra/llcommon/workqueue.cpp index 9c434bf2a9..cf80ce0656 100644 --- a/indra/llcommon/workqueue.cpp +++ b/indra/llcommon/workqueue.cpp @@ -18,6 +18,7 @@ // external library headers // other Linden headers #include "llcoros.h" +#include LLCOROS_MUTEX_HEADER #include "llerror.h" #include "llexception.h" #include "stringize.h" diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h index 4aab0a6537..e25a9ea7ef 100644 --- a/indra/llmessage/message.h +++ b/indra/llmessage/message.h @@ -58,6 +58,7 @@ #include "boost/function.hpp" #include "llpounceable.h" #include "llcoros.h" +#include LLCOROS_MUTEX_HEADER const U32 MESSAGE_MAX_STRINGS_LENGTH = 64; const U32 MESSAGE_NUMBER_OF_HASH_BUCKETS = 8192; -- cgit v1.2.3