diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2017-12-15 10:15:05 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2017-12-15 10:15:05 +0300 |
commit | 15be5550428692304d0f35c62145030d17fc3b1b (patch) | |
tree | 9658ead25a567d5884b8ec3f5343684f797d49d2 /pthread_support.c | |
parent | 1e2d919ef0c1845dbe2f12dbbcff9e05055e2ea3 (diff) | |
download | bdwgc-15be5550428692304d0f35c62145030d17fc3b1b.tar.gz |
Workaround TSan hang in free_inner when called from at-fork child handler
* pthread_support.c [CAN_HANDLE_FORK] (GC_remove_all_threads_but_me):
Do not call GC_INTERNAL_FREE(p) if THREAD_SANITIZER and CAN_CALL_ATFORK;
add comment.
Diffstat (limited to 'pthread_support.c')
-rw-r--r-- | pthread_support.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pthread_support.c b/pthread_support.c index ae262fde..bb8a0d58 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -801,7 +801,11 @@ STATIC void GC_remove_all_threads_but_me(void) GC_remove_specific_after_fork(GC_thread_key, p -> id); } # endif - if (p != &first_thread) GC_INTERNAL_FREE(p); + /* TODO: To avoid TSan hang (when updating GC_bytes_freed), */ + /* we just skip explicit freeing of GC_threads entries. */ +# if !defined(THREAD_SANITIZER) || !defined(CAN_CALL_ATFORK) + if (p != &first_thread) GC_INTERNAL_FREE(p); +# endif } } store_to_threads_table(hv, me); |