summaryrefslogtreecommitdiff
path: root/indra/llcommon/lleventcoro.cpp
diff options
context:
space:
mode:
authorcallum_linden <none@none>2016-05-23 16:50:56 -0700
committercallum_linden <none@none>2016-05-23 16:50:56 -0700
commit05fcb7c8126a3f3496d948affe7f2722c9ca8fad (patch)
tree159e542492c5c1fab1a04ef8a29b22fd60e4766a /indra/llcommon/lleventcoro.cpp
parent50ab1e57ec21f2009013b3bc061047887cdd07d5 (diff)
parentc2ef3b4c7186dbbd95b16520f281b7d58364fb52 (diff)
Automated merge with tip of viewer-release
Diffstat (limited to 'indra/llcommon/lleventcoro.cpp')
-rw-r--r--[-rwxr-xr-x]indra/llcommon/lleventcoro.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/indra/llcommon/lleventcoro.cpp b/indra/llcommon/lleventcoro.cpp
index 578a2b62c8..2d5f964deb 100755..100644
--- a/indra/llcommon/lleventcoro.cpp
+++ b/indra/llcommon/lleventcoro.cpp
@@ -229,6 +229,28 @@ LLSD llcoro::postAndSuspend(const LLSD& event, const LLEventPumpOrPumpName& requ
return value;
}
+LLSD llcoro::suspendUntilEventOnWithTimeout(const LLEventPumpOrPumpName& suspendPumpOrName,
+ F32 timeoutin, const LLSD &timeoutResult)
+{
+ /**
+ * The timeout pump is attached upstream of of the waiting pump and will
+ * pass the timeout event through it. We CAN NOT attach downstream since
+ * doing so will cause the suspendPump to fire any waiting events immediately
+ * and they will be lost. This becomes especially problematic with the
+ * LLEventTimeout(pump) constructor which will also attempt to fire those
+ * events using the virtual listen_impl method in the not yet fully constructed
+ * timeoutPump.
+ */
+ LLEventTimeout timeoutPump;
+ LLEventPump &suspendPump = suspendPumpOrName.getPump();
+
+ LLTempBoundListener timeoutListener(timeoutPump.listen(suspendPump.getName(),
+ boost::bind(&LLEventPump::post, &suspendPump, _1)));
+
+ timeoutPump.eventAfter(timeoutin, timeoutResult);
+ return llcoro::suspendUntilEventOn(suspendPump);
+}
+
namespace
{