summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMorten Sørvig <morten.sorvig@qt.io>2022-08-18 23:47:43 +0200
committerMorten Sørvig <morten.sorvig@qt.io>2022-08-24 21:12:00 +0200
commitcd73301a2e088ee03d2b505a3eb4edc14e83fb52 (patch)
treeb07932a49ab20511f3c693576c0ae55e19bad059 /src
parent52ebf31d2b97513b2e3f9b46c99e60249d2b61fe (diff)
wasm: disable asyncify for non-static builds
The asyncify support in the event loop currently uses EM_JS, which Emscripten does not support using from side modules. Change-Id: I5f961d9cd12f7b1b6cc1c2382b807a1da2918725 Reviewed-by: Lorn Potter <lorn.potter@gmail.com> Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qeventdispatcher_wasm.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_wasm.cpp b/src/corelib/kernel/qeventdispatcher_wasm.cpp
index 7ae29e616d..cd7d3583b4 100644
--- a/src/corelib/kernel/qeventdispatcher_wasm.cpp
+++ b/src/corelib/kernel/qeventdispatcher_wasm.cpp
@@ -32,6 +32,8 @@ Q_LOGGING_CATEGORY(lcEventDispatcherTimers, "qt.eventdispatcher.timers");
// track Qts own usage of asyncify.
static bool g_is_asyncify_suspended = false;
+#if defined(QT_STATIC)
+
EM_JS(bool, qt_have_asyncify_js, (), {
return typeof Asyncify != "undefined";
});
@@ -54,6 +56,27 @@ EM_JS(void, qt_asyncify_resume_js, (), {
setTimeout(wakeUp);
});
+#else
+
+// EM_JS is not supported for side modules; disable asyncify
+
+bool qt_have_asyncify_js()
+{
+ return false;
+}
+
+void qt_asyncify_suspend_js()
+{
+ Q_UNREACHABLE();
+}
+
+void qt_asyncify_resume_js()
+{
+ Q_UNREACHABLE();
+}
+
+#endif // defined(QT_STATIC)
+
// Returns true if asyncify is available.
bool qt_have_asyncify()
{