From cfdc86ff38a5dfd2363f204bf6a0c55f402bdace Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Wed, 22 Nov 2017 11:35:08 +0300 Subject: Workaround TSan false positive in lookup_thread called by suspend_handler * include/private/pthread_support.h (THREAD_TABLE_INDEX): Move the macro from pthread_support.c file. * pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL && THREAD_SANITIZER] (GC_lookup_thread_async): New static function (same implementation as of GC_lookup_thread but with GC_ATTR_NO_SANITIZE_THREAD attribute); add comment. * pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL && !THREAD_SANITIZER] (GC_lookup_thread_async): Define as macro. * pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL] (GC_suspend_handler_inner): Call GC_lookup_thread_async() instead of GC_lookup_thread(); move the corresponding comment to GC_lookup_thread_async. --- pthread_support.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'pthread_support.c') diff --git a/pthread_support.c b/pthread_support.c index cbb66c50..90602de2 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -528,11 +528,6 @@ void GC_push_thread_structures(void) /* It may not be safe to allocate when we register the first thread. */ static struct GC_Thread_Rep first_thread; -#define THREAD_TABLE_INDEX(id) \ - (int)(((NUMERIC_THREAD_ID(id) >> 16) \ - ^ (NUMERIC_THREAD_ID(id) >> 8) \ - ^ NUMERIC_THREAD_ID(id)) % THREAD_TABLE_SZ) - /* Add a thread to GC_threads. We assume it wasn't already there. */ /* Caller holds allocation lock. */ STATIC GC_thread GC_new_thread(pthread_t id) -- cgit v1.2.1