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>
bb10
Morten Sørvig 2022-08-18 23:47:43 +02:00
parent 52ebf31d2b
commit cd73301a2e
1 changed files with 23 additions and 0 deletions

View File

@ -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()
{