diff options
| author | Oz Linden <oz@lindenlab.com> | 2016-05-06 10:28:42 -0400 |
|---|---|---|
| committer | Oz Linden <oz@lindenlab.com> | 2016-05-06 10:28:42 -0400 |
| commit | 950c41d184b340a7a3370c2cbda5d1eed9a17b0b (patch) | |
| tree | 373912394af6834d7d56258becf46954244b8423 /indra/llcommon/lleventcoro.cpp | |
| parent | 20198b750d02c769ab6845226f98ce6e5dd1f20b (diff) | |
| parent | 7f5e6cea124e1193b199a3eabd50bdab96340c13 (diff) | |
merge 4.0.4-release and MAINT-5974
Diffstat (limited to 'indra/llcommon/lleventcoro.cpp')
| -rw-r--r-- | indra/llcommon/lleventcoro.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/indra/llcommon/lleventcoro.cpp b/indra/llcommon/lleventcoro.cpp index 578a2b62c8..2d5f964deb 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 { |
