summaryrefslogtreecommitdiff
path: root/desktop/source
diff options
context:
space:
mode:
authorStephan Bergmann <stephan.bergmann@allotropia.de>2024-09-03 09:38:58 +0200
committerStephan Bergmann <stephan.bergmann@allotropia.de>2024-09-03 13:47:21 +0200
commit24a3a7c72714c4f45c46cd2b6274013503d444d6 (patch)
treef0619c2bb867b18e57e3d14adaccb0afdd94a216 /desktop/source
parent9778a09b858f6f11c3bea988bff409215e495ad1 (diff)
Emscripten: workerID is only defined under -sASSERTIONS
...and explicitly passing in pthread_self() on the calling side is better than trying to identify the calling thread on the callee side, anyway Change-Id: Ib26a7cbdede246280b6985b6eb1582baf172bf59 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172786 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Diffstat (limited to 'desktop/source')
-rw-r--r--desktop/source/app/appinit.cxx17
1 files changed, 5 insertions, 12 deletions
diff --git a/desktop/source/app/appinit.cxx b/desktop/source/app/appinit.cxx
index 3a8bce551d6a..16f023b0a414 100644
--- a/desktop/source/app/appinit.cxx
+++ b/desktop/source/app/appinit.cxx
@@ -93,20 +93,13 @@ EM_JS(void, setupMainChannel, (), {
};
});
-extern "C" void resolveUnoMain() {
- EM_ASM(
- let sofficeMain;
- for (const i in PThread.pthreads) {
- const worker = PThread.pthreads[i];
- if (worker.workerID === 1) {
- sofficeMain = worker;
- break;
- }
- }
+extern "C" void resolveUnoMain(pthread_t id) {
+ EM_ASM({
+ const sofficeMain = PThread.pthreads[$0];
const channel = new MessageChannel();
sofficeMain.postMessage({cmd:"LOWA-channel"}, [channel.port2]);
Module.uno_main$resolve(channel.port1);
- );
+ }, id);
}
void initUno() {
@@ -120,7 +113,7 @@ void initUno() {
runUnoScriptUrl(url.getStr());
}
setupMainChannel();
- emscripten_async_run_in_main_runtime_thread(EM_FUNC_SIG_V, resolveUnoMain);
+ emscripten_async_run_in_main_runtime_thread(EM_FUNC_SIG_VI, resolveUnoMain, pthread_self());
}
}