-
Notifications
You must be signed in to change notification settings - Fork 408
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid hang in usleep during signals resend in child process if TSan
Issue #236 (bdwgc). If a multi-threaded process has been forked, then TSan (as of now) cannot reasonably function in the child, e.g. usleep() may hang because some internal lock is not released at fork. The current solution is just to disable signals resend in the child process if there are threads not survived during fork. * include/private/pthread_stop_world.h [CAN_HANDLE_FORK && THREAD_SANITIZER && SIGNAL_BASED_STOP_WORLD] (GC_retry_signals): Declare GC_EXTERN variable. * pthread_stop_world.c [CAN_HANDLE_FORK && THREAD_SANITIZER] (GC_retry_signals): Define as GC_INNER (instead of STATIC). * pthread_stop_world.c (GC_retry_signals): Always initialize to FALSE; move comment to GC_stop_init. * pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL && !NO_RETRY_SIGNALS] (GC_stop_init): Set GC_retry_signals to TRUE. * pthread_support.c [CAN_HANDLE_FORK] (GC_remove_all_threads_but_me): Update comment; change return type to GC_bool; define, set and return removed local variable. * pthread_support.c [CAN_HANDLE_FORK] (fork_child_proc): Define threads_removed local variable and set it to the result of GC_remove_all_threads_but_me(). * pthread_support.c [CAN_HANDLE_FORK && THREAD_SANITIZER && SIGNAL_BASED_STOP_WORLD] (fork_child_proc): If threads_removed or GC_parallel then GC_retry_signals set to FALSE; add comment.
- Loading branch information
Showing
3 changed files
with
38 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters