Fix data race in GC_suspend/resume_thread
authorIvan Maidanski <ivmai@mail.ru>
Thu, 23 Nov 2017 09:20:18 +0000 (12:20 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 23 Nov 2017 09:20:18 +0000 (12:20 +0300)
commitce09fd5e53d75d8bc352a09bf779d56d0c7711e9
treec100c4c3fa3c504cc876af31a30988a386009177
parentb613150da40c2afd800e99fd1e032eeeb8016160
Fix data race in GC_suspend/resume_thread

* include/private/pthread_support.h [GC_ENABLE_SUSPEND_THREAD
&& !GC_DARWIN_THREADS && !GC_OPENBSD_UTHREADS && !NACL]
(GC_Thread_Rep.suspended_ext): New field.
* include/private/pthread_support.h (SUSPENDED_EXT): Remove macro.
* pthread_stop_world.c [GC_ENABLE_SUSPEND_THREAD
&& !GC_OPENBSD_UTHREADS && !NACL] (GC_suspend_handler_inner): Replace
me->flags & SUSPENDED_EXT with AO_load(&me->suspended_ext).
* pthread_stop_world.c [GC_ENABLE_SUSPEND_THREAD
&& !GC_OPENBSD_UTHREADS && !NACL] (suspend_self_inner): Replace
me->flags & SUSPENDED_EXT with AO_load_acquire(&me->suspended_ext).
* pthread_stop_world.c [GC_ENABLE_SUSPEND_THREAD
&& !GC_OPENBSD_UTHREADS && !NACL] (GC_suspend_thread): Replace
t->flags & SUSPENDED_EXT with t->suspended_ext; replace
t->flags|=SUSPENDED_EXT with AO_store_release(&t->suspended_ext, TRUE);
add comment.
* pthread_stop_world.c [GC_ENABLE_SUSPEND_THREAD
&& !GC_OPENBSD_UTHREADS && !NACL] (GC_resume_thread): Replace
t->flags&=~SUSPENDED_EXT with AO_store(&t->suspended_ext, FALSE).
* pthread_stop_world.c [GC_ENABLE_SUSPEND_THREAD
&& !GC_OPENBSD_UTHREADS && !NACL] (GC_is_thread_suspended,
GC_suspend_all, GC_start_world): Replace t->flags & SUSPENDED_EXT with
t->suspended_ext.
* pthread_support.c (GC_register_my_thread): Remove assertion that uses
SUSPENDED_EXT.
include/private/pthread_support.h
pthread_stop_world.c
pthread_support.c