diff options
author | AndreyL ProductEngine <alihatskiy@productengine.com> | 2016-04-28 23:11:42 +0300 |
---|---|---|
committer | AndreyL ProductEngine <alihatskiy@productengine.com> | 2016-04-28 23:11:42 +0300 |
commit | 2b731af53af8a4836786be4265a59a108d637f9a (patch) | |
tree | d32abb6fa681d6ab801c84b5e43bc651f7bab2d0 /indra/llcommon/lleventcoro.cpp | |
parent | 5ec93df56a27af6763ae7fbd84bd6edd4145540b (diff) | |
parent | 3771778ac3063860319b4eabb55c289ff00fc952 (diff) |
Merged in lindenlab/viewer-bear
Diffstat (limited to 'indra/llcommon/lleventcoro.cpp')
-rwxr-xr-x | indra/llcommon/lleventcoro.cpp | 21 |
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 |