summaryrefslogtreecommitdiff
path: root/indra/llcommon/llcoros.h
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-09-04 14:07:26 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-09-04 14:07:26 -0400
commitea24ac899ca28a587be0e187b77873a25d08a556 (patch)
tree4645577b8c1e3b60079a67c98dd95c9a03a7c8c6 /indra/llcommon/llcoros.h
parent03d7f2b84daf9ab991de6cad7d6149abda1ef716 (diff)
Extract coroutine-aware synchronization primitives to new header.
Changes on new main and changes on Lua project branch combined into a header circularity. Resolved by hoisting coroutine-aware synchronization primitives out to a new llcoromutex.h file in the `llcoro` namespace, rather than being literally members of the `LLCoros` class. But retained `using` declarations in `LLCoros` for backwards compatibility.
Diffstat (limited to 'indra/llcommon/llcoros.h')
-rw-r--r--indra/llcommon/llcoros.h34
1 files changed, 9 insertions, 25 deletions
diff --git a/indra/llcommon/llcoros.h b/indra/llcommon/llcoros.h
index f26ed882e8..b7ca1af109 100644
--- a/indra/llcommon/llcoros.h
+++ b/indra/llcommon/llcoros.h
@@ -29,31 +29,17 @@
#if ! defined(LL_LLCOROS_H)
#define LL_LLCOROS_H
+#include "llcoromutex.h"
#include "llevents.h"
#include "llexception.h"
#include "llinstancetracker.h"
#include "llsingleton.h"
-#include "mutex.h"
#include <boost/fiber/fss.hpp>
-#include <boost/fiber/future/promise.hpp>
-#include <boost/fiber/future/future.hpp>
#include <exception>
#include <functional>
#include <queue>
#include <string>
-// e.g. #include LLCOROS_MUTEX_HEADER
-#define LLCOROS_MUTEX_HEADER <boost/fiber/mutex.hpp>
-#define LLCOROS_CONDVAR_HEADER <boost/fiber/condition_variable.hpp>
-
-namespace boost {
- namespace fibers {
- class mutex;
- enum class cv_status;
- class condition_variable;
- }
-}
-
/**
* Registry of named Boost.Coroutine instances
*
@@ -322,23 +308,21 @@ public:
LLVoidListener cleanup);
/**
- * Aliases for promise and future. An older underlying future implementation
- * required us to wrap future; that's no longer needed. However -- if it's
- * important to restore kill() functionality, we might need to provide a
- * proxy, so continue using the aliases.
+ * LLCoros aliases for promise and future, for backwards compatibility.
+ * These have been hoisted out to the llcoro namespace.
*/
template <typename T>
- using Promise = boost::fibers::promise<T>;
+ using Promise = llcoro::Promise<T>;
template <typename T>
- using Future = boost::fibers::future<T>;
+ using Future = llcoro::Future<T>;
template <typename T>
static Future<T> getFuture(Promise<T>& promise) { return promise.get_future(); }
// use mutex, lock, condition_variable suitable for coroutines
- using Mutex = boost::fibers::mutex;
- using LockType = std::unique_lock<Mutex>;
- using cv_status = boost::fibers::cv_status;
- using ConditionVariable = boost::fibers::condition_variable;
+ using Mutex = llcoro::Mutex;
+ using LockType = llcoro::LockType;
+ using cv_status = llcoro::cv_status;
+ using ConditionVariable = llcoro::ConditionVariable;
/// for data local to each running coroutine
template <typename T>