summaryrefslogtreecommitdiff
path: root/indra/newview/llcallbacklist.cpp
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2013-06-13 15:28:13 -0400
committerOz Linden <oz@lindenlab.com>2013-06-13 15:28:13 -0400
commit2268bf38339178f93b317693c0a6808807301d64 (patch)
tree0a17c21975babce8422b9b62a1683947f5a58f2c /indra/newview/llcallbacklist.cpp
parentd233d8836b610b5e5ca76a1e3bb4d63dc3592e66 (diff)
parentdcfb18373eca7986a73d8b9a1d34970cc0a23ed9 (diff)
merge changes for 3.5.3-release
Diffstat (limited to 'indra/newview/llcallbacklist.cpp')
-rwxr-xr-x[-rw-r--r--]indra/newview/llcallbacklist.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/indra/newview/llcallbacklist.cpp b/indra/newview/llcallbacklist.cpp
index 357a6582d1..79ec43dfe9 100644..100755
--- a/indra/newview/llcallbacklist.cpp
+++ b/indra/newview/llcallbacklist.cpp
@@ -27,6 +27,7 @@
#include "llviewerprecompiledheaders.h"
#include "llcallbacklist.h"
+#include "lleventtimer.h"
// Library includes
#include "llerror.h"
@@ -180,6 +181,54 @@ void doOnIdleRepeating(bool_func_t callable)
gIdleCallbacks.addFunction(&OnIdleCallbackRepeating::onIdle,cb_functor);
}
+class NullaryFuncEventTimer: public LLEventTimer
+{
+public:
+ NullaryFuncEventTimer(nullary_func_t callable, F32 seconds):
+ LLEventTimer(seconds),
+ mCallable(callable)
+ {
+ }
+
+private:
+ BOOL tick()
+ {
+ mCallable();
+ return TRUE;
+ }
+
+ nullary_func_t mCallable;
+};
+
+// Call a given callable once after specified interval.
+void doAfterInterval(nullary_func_t callable, F32 seconds)
+{
+ new NullaryFuncEventTimer(callable, seconds);
+}
+
+class BoolFuncEventTimer: public LLEventTimer
+{
+public:
+ BoolFuncEventTimer(bool_func_t callable, F32 seconds):
+ LLEventTimer(seconds),
+ mCallable(callable)
+ {
+ }
+private:
+ BOOL tick()
+ {
+ return mCallable();
+ }
+
+ bool_func_t mCallable;
+};
+
+// Call a given callable every specified number of seconds, until it returns true.
+void doPeriodically(bool_func_t callable, F32 seconds)
+{
+ new BoolFuncEventTimer(callable, seconds);
+}
+
#ifdef _DEBUG
void test1(void *data)