DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit 34bf2a4dfca724fc544f8ab0a15727ddf558d7d8
parent ee94ba0caeabe25e2ecff1039d321e8edb5acedd
Author: falkTX <falktx@falktx.com>
Date:   Thu,  7 Jul 2022 00:59:38 +0100

Use emscripten_set_timeout_loop instead of manual management

Signed-off-by: falkTX <falktx@falktx.com>

Diffstat:
Mdistrho/extra/Runner.hpp | 16+++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/distrho/extra/Runner.hpp b/distrho/extra/Runner.hpp @@ -23,7 +23,7 @@ # include "Thread.hpp" #else # include "String.hpp" -# include <emscripten/emscripten.h> +# include <emscripten/html5.h> #endif START_NAMESPACE_DISTRHO @@ -114,7 +114,7 @@ public: return fRunnerThread.startThread(); #else fShouldStop = false; - emscripten_async_call(_entryPoint, this, timeIntervalMilliseconds); + emscripten_set_timeout_loop(_entryPoint, timeIntervalMilliseconds, this); return true; #endif } @@ -204,10 +204,10 @@ private: const String fRunnerName; volatile bool fShouldStop; - void _runEntryPoint() noexcept + EM_BOOL _runEntryPoint() noexcept { if (fShouldStop) - return; + return EM_FALSE; bool stillRunning = false; @@ -216,12 +216,14 @@ private: } catch(...) {} if (stillRunning && !fShouldStop) - emscripten_async_call(_entryPoint, this, fTimeInterval); + return EM_TRUE; + + return EM_FALSE; } - static void _entryPoint(void* const userData) noexcept + static EM_BOOL _entryPoint(double, void* const userData) noexcept { - static_cast<Runner*>(userData)->_runEntryPoint(); + return static_cast<Runner*>(userData)->_runEntryPoint(); } #endif