summaryrefslogtreecommitdiff
path: root/indra/newview/llcallbacklist.cpp
diff options
context:
space:
mode:
authorNyx (Neal Orman) <nyx@lindenlab.com>2012-11-06 18:18:27 -0500
committerNyx (Neal Orman) <nyx@lindenlab.com>2012-11-06 18:18:27 -0500
commitc3b00d4063fe4f85ec293b98750735b94776c4fe (patch)
treed49e13d60af8bf9b346536623ccae7bee3602eea /indra/newview/llcallbacklist.cpp
parent85e03582b21aef8a74613d14d5dcde63cf476cdb (diff)
parentee2bc008ea8f04ffd1271787382a2b756e6293aa (diff)
merge
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)