diff options
| author | Oz Linden <oz@lindenlab.com> | 2013-05-20 09:08:20 -0400 |
|---|---|---|
| committer | Oz Linden <oz@lindenlab.com> | 2013-05-20 09:08:20 -0400 |
| commit | 72e7269da376d660385f3c66ac2a25a5e50871ea (patch) | |
| tree | 047bd9d1bf99fa8c308c379dd57758050aa5ef51 /indra/newview/llcallbacklist.cpp | |
| parent | 621085d553cccc4238d74886ca44bcefafddd7f1 (diff) | |
| parent | 0ebcb7e3fd1452d42b5ca48139f99a4fd632d235 (diff) | |
merge changes for 3.5.2-release
Diffstat (limited to 'indra/newview/llcallbacklist.cpp')
| -rwxr-xr-x[-rw-r--r--] | indra/newview/llcallbacklist.cpp | 49 |
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) |
