summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llcommon/llcond.h1
-rw-r--r--indra/llcommon/llcoros.h14
-rw-r--r--indra/llcommon/lleventcoro.cpp6
-rw-r--r--indra/llcommon/llthreadsafequeue.h9
-rw-r--r--indra/llcommon/workqueue.cpp1
-rw-r--r--indra/llmessage/message.h1
6 files changed, 21 insertions, 11 deletions
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 <chrono>
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 <exception>
#include <queue>
+// 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;
@@ -285,17 +289,17 @@ public:
* proxy, so continue using the aliases.
*/
template <typename T>
- using Promise = std::promise<T>;
+ using Promise = boost::fibers::promise<T>;
template <typename T>
- using Future = std::future<T>;
+ using Future = boost::fibers::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 = std::mutex;
+ using Mutex = boost::fibers::mutex;
using LockType = std::unique_lock<Mutex>;
- 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 <typename T>
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<LLSD> 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 <boost/fiber/timed_mutex.hpp>
+#include LLCOROS_CONDVAR_HEADER
#include "llexception.h"
#include "mutex.h"
#include <chrono>
@@ -179,10 +182,10 @@ protected:
size_t mCapacity;
bool mClosed;
- std::timed_mutex mLock;
+ boost::fibers::timed_mutex mLock;
typedef std::unique_lock<decltype(mLock)> 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;