sal/osl/unx/thread.cxx | 5 +++++
1 file changed, 5 insertions(+)
New commits:
commit a0878a63eb38e8d0a24fcd882b11ba82a6b366ff
Author: Stephan Bergmann <[email protected]>
AuthorDate: Thu Aug 28 15:39:41 2025 +0200
Commit: Stephan Bergmann <[email protected]>
CommitDate: Thu Aug 28 18:45:54 2025 +0200
osl_setThreadName for Emscripten
...which just logs the name to the console, but which is better than
nothing,
esp. in scenarios like running the Emscripten app from a SharedWorker and
then
looking at the individual workers (i.e., threads) in Firefox'
<about:debugging#/runtime/this-firefox>, where they are hard to distinguish
Change-Id: Ibb379c314fd23bdf077e10b2a9bc1e194f20c7ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190333
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <[email protected]>
diff --git a/sal/osl/unx/thread.cxx b/sal/osl/unx/thread.cxx
index 3d51f4ab2a33..315a049e3a86 100644
--- a/sal/osl/unx/thread.cxx
+++ b/sal/osl/unx/thread.cxx
@@ -50,6 +50,9 @@
#include <android/log.h>
#include <osl/detail/android-bootstrap.h>
#endif
+#if defined __EMSCRIPTEN__
+#include <emscripten/console.h>
+#endif
#if defined LINUX && ! defined __FreeBSD_kernel__
#include <sys/syscall.h>
@@ -552,6 +555,8 @@ void SAL_CALL osl_setThreadName(char const * name)
pthread_setname_np( pthread_self(), name );
#elif defined MACOSX || defined IOS
pthread_setname_np( name );
+#elif defined __EMSCRIPTEN__
+ emscripten_console_logf("Thread name: \"%s\"", name);
#else
(void) name;
#endif