summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2016-04-22 12:07:27 -0700
committerRider Linden <rider@lindenlab.com>2016-04-22 12:07:27 -0700
commit899489ae0a4bc4eb187e7813e338b937384a1866 (patch)
treee83b388e1f35d1fe53701203131cd94ac5216ec2 /indra/llcommon
parent8f4be8bb869e3cde034607cbe0cb8272005f08b8 (diff)
MAINT-6336: Centralize waiting on event pump with a timeout. Shorten the lifespan of a timeout event pump lifespan to be no longer than necessary. Change all references to the LLEventTimer to instead uses the centralized version.
Diffstat (limited to 'indra/llcommon')
-rwxr-xr-xindra/llcommon/lleventcoro.cpp9
-rwxr-xr-xindra/llcommon/lleventcoro.h2
-rwxr-xr-xindra/llcommon/lleventfilter.cpp4
-rwxr-xr-xindra/llcommon/lleventfilter.h3
4 files changed, 16 insertions, 2 deletions
diff --git a/indra/llcommon/lleventcoro.cpp b/indra/llcommon/lleventcoro.cpp
index 578a2b62c8..44291eb711 100755
--- a/indra/llcommon/lleventcoro.cpp
+++ b/indra/llcommon/lleventcoro.cpp
@@ -229,6 +229,15 @@ LLSD llcoro::postAndSuspend(const LLSD& event, const LLEventPumpOrPumpName& requ
return value;
}
+LLSD llcoro::suspendUntilEventOnWithTimeout(const LLEventPumpOrPumpName& pump, F32 timeoutin, const LLSD &timeoutResult)
+{
+ LLEventTimeout timeoutPump(pump);
+
+ timeoutPump.eventAfter(timeoutin, timeoutResult);
+ return llcoro::suspendUntilEventOn(timeoutPump);
+
+}
+
namespace
{
diff --git a/indra/llcommon/lleventcoro.h b/indra/llcommon/lleventcoro.h
index 2105faf861..19c68e1f35 100755
--- a/indra/llcommon/lleventcoro.h
+++ b/indra/llcommon/lleventcoro.h
@@ -147,6 +147,8 @@ LLSD suspendUntilEventOn(const LLEventPumpOrPumpName& pump)
return postAndSuspend(LLSD(), LLEventPumpOrPumpName(), pump);
}
+LLSD suspendUntilEventOnWithTimeout(const LLEventPumpOrPumpName& pump, F32 timeoutin, const LLSD &timeoutResult);
+
} // namespace llcoro
/// return type for two-pump variant of suspendUntilEventOn()
diff --git a/indra/llcommon/lleventfilter.cpp b/indra/llcommon/lleventfilter.cpp
index d36a107254..64ab58adcd 100755
--- a/indra/llcommon/lleventfilter.cpp
+++ b/indra/llcommon/lleventfilter.cpp
@@ -39,9 +39,9 @@
#include "llsdutil.h" // llsd_matches()
LLEventFilter::LLEventFilter(LLEventPump& source, const std::string& name, bool tweak):
- LLEventStream(name, tweak)
+ LLEventStream(name, tweak),
+ mSource(source.listen(getName(), boost::bind(&LLEventFilter::post, this, _1)))
{
- source.listen(getName(), boost::bind(&LLEventFilter::post, this, _1));
}
LLEventMatching::LLEventMatching(const LLSD& pattern):
diff --git a/indra/llcommon/lleventfilter.h b/indra/llcommon/lleventfilter.h
index 8e01326823..15bac5fd73 100755
--- a/indra/llcommon/lleventfilter.h
+++ b/indra/llcommon/lleventfilter.h
@@ -49,6 +49,9 @@ public:
/// Post an event to all listeners
virtual bool post(const LLSD& event) = 0;
+
+private:
+ LLTempBoundListener mSource;
};
/**