summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorn Potter <lorn.potter@gmail.com>2022-08-22 14:06:45 +1000
committerMorten Johan Sørvig <morten.sorvig@qt.io>2022-09-09 06:03:26 +0000
commite9354a17ea825ca5b0c3e549c82e08c8c99bd065 (patch)
tree838b3117ae7f774f9c66e0184cfd0782b2bb5538
parent81f78ae04ad61882dfb8daa6829d043bf47beaac (diff)
downloadqtdoc-e9354a17ea825ca5b0c3e549c82e08c8c99bd065.tar.gz
wasm: Update asyncify instructions
It is now link time enabled Change-Id: I4e2c091614d38fef80e2cc051e207f163cd85a0c Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> (cherry picked from commit 8a9ec5504abdecd7bbe88f85deff1919221f7309) (cherry picked from commit e37a546ff844e6a7ff8faeb484c88f114b19955b) Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
-rw-r--r--doc/src/platforms/wasm.qdoc27
1 files changed, 27 insertions, 0 deletions
diff --git a/doc/src/platforms/wasm.qdoc b/doc/src/platforms/wasm.qdoc
index eddb66cc..3b1ae356 100644
--- a/doc/src/platforms/wasm.qdoc
+++ b/doc/src/platforms/wasm.qdoc
@@ -509,6 +509,33 @@ int main(int argc, char **argc)
}
\endcode
+\section3 Asyncify
+
+The default build of Qt for WebAssembly does not support reentering the event loop,
+for example by calling QEventLoop::exec() or QDialog::exec(), due to resitrictions
+of the web platform.
+
+Emscripten's \l{https://emscripten.org/docs/porting/asyncify.html}{asyncify} feature lifts
+these restrictions by allowing sychronous calls (like QEventLoop::exec() and QDialog::exec())
+to yield to the event loop. Nested calls are not supported, and for this reason asyncify is
+not used for the top-level QApplication::exec() call.
+
+As of Qt 6.4, Asyncify support is enabled in the binary package, but needs to be enabled for
+applications by adding -sASYNCIFY -Os to linker options:
+
+CMake:
+\badcode
+set target_link_options(<target> PUBLIC -sASYNCIFY -Os)
+\endcode
+
+qmake:
+\badcode
+QMAKE_LFLAGS += -sASYNCIFY -Os)
+\endcode
+
+Enabling asyncify adds overhead in the form of increased binary sizes and increased CPU
+usage. Build with optimizations enabled to minimize the overhead.
+
\section2 Debugging and Profiling
Wasm debugging is done on browser javascript console, debugging applications on Wasm