diff options
| author | Logan Dethrow <log@lindenlab.com> | 2012-12-11 16:38:10 -0500 |
|---|---|---|
| committer | Logan Dethrow <log@lindenlab.com> | 2012-12-11 16:38:10 -0500 |
| commit | 03025733484f7f1ea46d0356e65b0d142bc1dbdb (patch) | |
| tree | d48902f9fab2fdc4d15850ffee3d6860f550bcb4 /indra/newview/llcallbacklist.cpp | |
| parent | edcdce226a7ff599e43c89fe7e4d37350650ae96 (diff) | |
| parent | 798377b076fbce895ba2075417107de0da10b9ca (diff) | |
Automated merge with ssh://bitbucket.org/lindenlab/viewer-development
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) |
