Fix lock assertion violation in GC_new_thread if GC_ALWAYS_MULTITHREADED
authorIvan Maidanski <ivmai@mail.ru>
Tue, 20 Oct 2015 21:48:56 +0000 (00:48 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 20 Oct 2015 21:48:56 +0000 (00:48 +0300)
commit2d79f88938ca8bbe2eabf05dc4ba98fd0ec63dae
tree9b8b8820cf32b1ae291c894d383b8ee5b14ef65f
parent60af658b0071b5ed3c9b8e6c0ad6ac3adc086a3e
Fix lock assertion violation in GC_new_thread if GC_ALWAYS_MULTITHREADED

* include/private/gc_priv.h (GC_start_mark_threads_inner): Define macro
(or declare function depending on CAN_HANDLE_FORK).
* misc.c (GC_init): Surround GC_thr_init call with LOCK/UNLOCK (only
if GC_ASSERTIONS and GC_ALWAYS_MULTITHREADED otherwise redundant);
call GC_start_mark_threads_inner (if PARALLEL_MARK).
* pthread_support.c (GC_mark_thread): Update comment.
* win32_threads.c (GC_mark_thread): Likewise.
* pthread_support.c (start_mark_threads): Remove macro (moved to
gc_priv.h); rename function to GC_start_mark_threads_inner; replace
"static" to GC_INNER; check assertion on GC_fl_builder_count only if
the markers should actually be started; move the check for disabled
parallel markers (available_markers_m1) from GC_thr_init (make it
unconditional).
* win32_threads.c (start_mark_threads): Likewise.
* win32_threads.c (GC_start_mark_threads_inner): Add assertion about
the lock status.
* pthread_support.c (GC_thr_init): Remove comment about expected lock
status; add assertion about holding the lock (duplicating that in
GC_new_thread); remove start_mark_threads call (moved to GC_init).
* win32_threads.c (GC_thr_init): Likewise.
include/private/gc_priv.h
misc.c
pthread_support.c
win32_threads.c