diff options
| author | Merov Linden <merov@lindenlab.com> | 2013-05-02 14:09:40 -0700 |
|---|---|---|
| committer | Merov Linden <merov@lindenlab.com> | 2013-05-02 14:09:40 -0700 |
| commit | 043f2e0bfd40d29464175de838e3a36aad6e81df (patch) | |
| tree | a84a7d8ab7a4b0c3a6afb3a7b2007c9ce4a36afb /indra/newview/llcallbacklist.cpp | |
| parent | d07fab9e165e354678f5f8f78d331f8cfe8618d2 (diff) | |
| parent | 1beb15c93b139e4494bb90cce30b1c67accb4b08 (diff) | |
Pull from viewer-release
Diffstat (limited to 'indra/newview/llcallbacklist.cpp')
| -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 --- 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) |
