From 382f9f0786b5225ac6d9648241e6c04f4f94f262 Mon Sep 17 00:00:00 2001 From: AiraYumi Date: Sat, 13 Jan 2024 15:36:45 +0900 Subject: replace part of boost::fibers::* to std::* --- 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 - 5 files changed, 11 insertions(+), 20 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llcond.h b/indra/llcommon/llcond.h index da6e6affe1..a4bec124ca 100644 --- a/indra/llcommon/llcond.h +++ b/indra/llcommon/llcond.h @@ -16,7 +16,6 @@ #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 966ce03296..8160b87f23 100644 --- a/indra/llcommon/llcoros.h +++ b/indra/llcommon/llcoros.h @@ -41,10 +41,6 @@ #include #include -// e.g. #include LLCOROS_MUTEX_HEADER -#define LLCOROS_MUTEX_HEADER -#define LLCOROS_CONDVAR_HEADER - namespace boost { namespace fibers { class mutex; @@ -289,17 +285,17 @@ public: * proxy, so continue using the aliases. */ template - using Promise = boost::fibers::promise; + using Promise = std::promise; template - using Future = boost::fibers::future; + using Future = std::future; template static Future getFuture(Promise& promise) { return promise.get_future(); } // use mutex, lock, condition_variable suitable for coroutines - using Mutex = boost::fibers::mutex; + using Mutex = std::mutex; using LockType = std::unique_lock; - using cv_status = boost::fibers::cv_status; - using ConditionVariable = boost::fibers::condition_variable; + using cv_status = std::cv_status; + using ConditionVariable = std::condition_variable; /// for data local to each running coroutine template diff --git a/indra/llcommon/lleventcoro.cpp b/indra/llcommon/lleventcoro.cpp index 067b5e6fbc..97a7ad04ad 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 - boost::fibers::future_status status; + std::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 == boost::fibers::future_status::timeout) + if (status == std::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 == boost::fibers::future_status::ready); + llassert_always(status == std::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 f396a71e6f..0aa75c9b73 100644 --- a/indra/llcommon/llthreadsafequeue.h +++ b/indra/llcommon/llthreadsafequeue.h @@ -28,9 +28,6 @@ #define LL_LLTHREADSAFEQUEUE_H #include "llcoros.h" -#include LLCOROS_MUTEX_HEADER -#include -#include LLCOROS_CONDVAR_HEADER #include "llexception.h" #include "mutex.h" #include @@ -182,10 +179,10 @@ protected: size_t mCapacity; bool mClosed; - boost::fibers::timed_mutex mLock; + std::timed_mutex mLock; typedef std::unique_lock lock_t; - boost::fibers::condition_variable_any mCapacityCond; - boost::fibers::condition_variable_any mEmptyCond; + std::condition_variable_any mCapacityCond; + std::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 cf80ce0656..9c434bf2a9 100644 --- a/indra/llcommon/workqueue.cpp +++ b/indra/llcommon/workqueue.cpp @@ -18,7 +18,6 @@ // external library headers // other Linden headers #include "llcoros.h" -#include LLCOROS_MUTEX_HEADER #include "llerror.h" #include "llexception.h" #include "stringize.h" -- cgit v1.2.3