-
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.
Fix hang in select() called from suspend signal handler if TSan
Issue #236 (bdwgc). Previously select() was used to sleep in the suspend signal handler while the thread is manually suspended. This is changed to use sigsuspend() instead. (But select() is still used for a reason when the thread is self-suspended.) * pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL] (GC_stop_count): Update comment. * pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL && GC_ENABLE_SUSPEND_THREAD] (GC_suspend_handler_inner): Remove calls of GC_store_stack_ptr(), sem_post(), GC_suspend_self_inner(), RESTORE_CANCEL() (dedicated to manual thread suspend). * pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL && GC_ENABLE_SUSPEND_THREAD && E2K] (GC_suspend_handler_inner): Remove backing_store_end and backing_store_ptr set and clear dedicated to manual thread suspend. * pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL && GC_ENABLE_SUSPEND_THREAD] (GC_suspend_handler_inner): Repeat sigsuspend() while suspend_cnt&1 and me->stop_info.ext_suspend_cnt is not updated. * pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL && GC_ENABLE_SUSPEND_THREAD] (GC_suspend_self_inner): Add DISABLE_CANCEL() and RESTORE_CANCEL(); refine TODO item. * pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL && GC_ENABLE_SUSPEND_THREAD && DEBUG_THREADS] (GC_suspend_self_inner): Log "suspend self" and "resume self" events. * pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL && GC_ENABLE_SUSPEND_THREAD] (GC_suspend_thread): Rename saved_stop_count local variable to next_stop_count; add assertion that self thread is not suspended; replace sem_wait() in a loop to suspend_restart_barrier(1); increment GC_stop_count on exit of the function as well (instead of restore). * pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL && GC_ENABLE_SUSPEND_THREAD] (GC_resume_thread): Add assertion that GC_stop_count is odd; call raise_signal(GC_sig_thr_restart) and suspend_restart_barrier(1).
- Loading branch information
Showing
1 changed file
with
58 additions
and
46 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