Przeglądaj źródła

Set posix thread name for debug build (#3657)

Benbuck Nason 1 rok temu
rodzic
commit
a9cd8ba87a
1 zmienionych plików z 7 dodań i 0 usunięć
  1. 7 0
      core/shared/platform/common/posix/posix_thread.c

+ 7 - 0
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