summaryrefslogtreecommitdiff
path: root/indra/llcommon/lleventcoro.cpp
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2016-04-26 16:20:01 -0700
committerRider Linden <rider@lindenlab.com>2016-04-26 16:20:01 -0700
commit3771778ac3063860319b4eabb55c289ff00fc952 (patch)
tree4e8b05cf82e52d547fe808eac29f8236803bffc4 /indra/llcommon/lleventcoro.cpp
parent1eaed3d37f49e1a9e4d1c6c432de7801797a5d49 (diff)
parent66dd72459ae5ad17bfab622c71b2122233707dd4 (diff)
Merge
Diffstat (limited to 'indra/llcommon/lleventcoro.cpp')
-rwxr-xr-xindra/llcommon/lleventcoro.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/indra/llcommon/lleventcoro.cpp b/indra/llcommon/lleventcoro.cpp
index 44291eb711..2d5f964deb 100755
--- a/indra/llcommon/lleventcoro.cpp
+++ b/indra/llcommon/lleventcoro.cpp
@@ -229,13 +229,26 @@ LLSD llcoro::postAndSuspend(const LLSD& event, const LLEventPumpOrPumpName& requ
return value;
}
-LLSD llcoro::suspendUntilEventOnWithTimeout(const LLEventPumpOrPumpName& pump, F32 timeoutin, const LLSD &timeoutResult)
+LLSD llcoro::suspendUntilEventOnWithTimeout(const LLEventPumpOrPumpName& suspendPumpOrName,
+ F32 timeoutin, const LLSD &timeoutResult)
{
- LLEventTimeout timeoutPump(pump);
+ /**
+ * 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(timeoutPump);
-
+ return llcoro::suspendUntilEventOn(suspendPump);
}
namespace