[PATCH] D31474: Update suspended threads info to be compatible with darwin

Kuba (Brecka) Mracek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 29 13:31:29 PDT 2017


kubamracek added inline comments.


================
Comment at: lib/sanitizer_common/sanitizer_stoptheworld_mac.cc:32-40
+  thread_identifier_info_data_t info;
+  mach_msg_type_number_t info_count = THREAD_IDENTIFIER_INFO_COUNT;
+  kern_return_t err = thread_info(thread, THREAD_IDENTIFIER_INFO,
+                                  (thread_info_t)&info, &info_count);
+  if (err != KERN_SUCCESS) {
+    VReport(1, "Error - unable to get thread ident for a thread\n");
+    return 0;
----------------
Does this return the same value as `pthread_threadid_np`?  Can we use it instead?  Or even better, use `GetTid` from sanitizer_mac.cc?  Calling `thread_info` here sounds very expensive.

Why not store the thread_id's in the array directly?  If we really need to know both `thread_t` and `thread_id`, then we should have a struct that contains both and store the struct in the array.


https://reviews.llvm.org/D31474





More information about the llvm-commits mailing list