[PATCH] D29993: Use pthreads to store current thread id on darwin

Kuba (Brecka) Mracek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 15 13:33:19 PST 2017


kubamracek added inline comments.


================
Comment at: lib/lsan/lsan_common_linux.cc:37
 
+static THREADLOCAL u32 current_thread_tid = 0xffffff; // kInvalidTid
+u32 GetCurrentThread() { return current_thread_tid; }
----------------
Please use some constant.  Move the definition of kInvalidTid if you need to.


================
Comment at: lib/lsan/lsan_common_mac.cc:27
+  int disable_counter = 0;
+  u32 current_thread_id = 0xffffff;  // kInvalidTid from asan_thread.h
+} thread_info_t;
----------------
same here


================
Comment at: lib/lsan/lsan_common_mac.cc:28
+  u32 current_thread_id = 0xffffff;  // kInvalidTid from asan_thread.h
+} thread_info_t;
+
----------------
Can we come up with a better name for the struct?  Perhaps something containing "thread_local_data"...


================
Comment at: lib/lsan/lsan_common_mac.cc:35
 
-static int *get_tls_val(bool allocate) {
+static thread_info_t *get_tls_val() {
   pthread_once(&key_once, make_tls_key);
----------------
We're removing the "allocate" argument.  Wasn't that necessary for something?  Why did we have it in the first place?


https://reviews.llvm.org/D29993





More information about the llvm-commits mailing list