From a9cd8ba87ad899e90e89b458a947ae6de73a0124 Mon Sep 17 00:00:00 2001 From: Benbuck Nason Date: Mon, 29 Jul 2024 16:50:34 -0700 Subject: [PATCH] Set posix thread name for debug build (#3657) --- core/shared/platform/common/posix/posix_thread.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/shared/platform/common/posix/posix_thread.c b/core/shared/platform/common/posix/posix_thread.c index 39baaa23..d35a7773 100644 --- a/core/shared/platform/common/posix/posix_thread.c +++ b/core/shared/platform/common/posix/posix_thread.c @@ -48,6 +48,13 @@ os_thread_wrapper(void *arg) #endif #ifdef OS_ENABLE_WAKEUP_BLOCKING_OP os_end_blocking_op(); +#endif +#if BH_DEBUG != 0 +#if defined __APPLE__ + pthread_setname_np("wamr"); +#else + pthread_setname_np(pthread_self(), "wamr"); +#endif #endif start_func(thread_arg); #ifdef OS_ENABLE_HW_BOUND_CHECK