Browse Source

Use emscripten_set_timeout_loop instead of manual management

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.5.0
falkTX 2 years ago
parent
commit
c2cc825253
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 9 additions and 7 deletions
  1. +9
    -7
      source/utils/CarlaRunner.hpp

+ 9
- 7
source/utils/CarlaRunner.hpp View File

@@ -23,7 +23,7 @@
# include "CarlaThread.hpp"
#else
# include "CarlaString.hpp"
# include <emscripten/emscripten.h>
# include <emscripten/html5.h>
#endif

// -------------------------------------------------------------------------------------------------------------------
@@ -110,7 +110,7 @@ public:
return fRunnerThread.startThread();
#else
fShouldStop = false;
emscripten_async_call(_entryPoint, this, timeIntervalMilliseconds);
emscripten_set_timeout_loop(_entryPoint, timeIntervalMilliseconds, this);
return true;
#endif
}
@@ -200,10 +200,10 @@ private:
const CarlaString fRunnerName;
volatile bool fShouldStop;

void _runEntryPoint() noexcept
EM_BOOL _runEntryPoint() noexcept
{
if (fShouldStop)
return;
return EM_FALSE;

bool stillRunning = false;

@@ -212,12 +212,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<CarlaRunner*>(userData)->_runEntryPoint();
return static_cast<CarlaRunner*>(userData)->_runEntryPoint();
}
#endif



Loading…
Cancel
Save