diff options
author | callum_linden <none@none> | 2016-05-06 13:40:29 -0700 |
---|---|---|
committer | callum_linden <none@none> | 2016-05-06 13:40:29 -0700 |
commit | c5d6bfe8ae61e3311c260626b590586d3cde4b6e (patch) | |
tree | 4b731e4be618f6b9048bcc7e6dadf663f0baec49 /indra/llcommon/lleventcoro.cpp | |
parent | 811a0b5726ed965f9f21ace2d3ec97bb95a91311 (diff) | |
parent | 94559950a2c670990db56bd74e65d26652421b8c (diff) |
Merge with viewer-release
Diffstat (limited to 'indra/llcommon/lleventcoro.cpp')
-rwxr-xr-x | 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 100755 --- 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 { |