diff Platforms/Wasm/WasmDelayedCallExecutor.js @ 431:26b90b110719 am-vsol-upgrade

added DelayedCallExecutor to avoid using sleep() in C++ that consumes 100% CPU once executed in WASM
author am@osimis.io
date Thu, 29 Nov 2018 19:25:15 +0100
parents
children 5055031f4a06
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Platforms/Wasm/WasmDelayedCallExecutor.js	Thu Nov 29 19:25:15 2018 +0100
@@ -0,0 +1,7 @@
+mergeInto(LibraryManager.library, {
+  WasmDelayedCallExecutor_Schedule: function(callable, timeoutInMs/*, payload*/) {
+    setTimeout(function() {
+      WasmDelayedCallExecutor_ExecuteCallback(callable/*, payload*/);
+    }, timeoutInMs);
+  }
+});