From fb39e721b04b75aff75a2b8e45318f0fc060263e Mon Sep 17 00:00:00 2001 From: Adrian Pop Date: Fri, 10 Jun 2016 20:39:18 +0300 Subject: [PATCH] Workaround a bug in winpthreads causing parallel marks deadlock (MinGW) The solution is to use Win32 threads for parallel markers while using winpthreads to provide GC-aware pthread_create/join/detach and fork. See details in GitHub issue #81 and issue #119. * win32_threads.c (GC_PTHREADS_PARAMARK): Do not define if GC_PTHREADS, PARALLEL_MARK and __MINGW32__ (to workaround a deadlock in do_sema_b_wait() of winpthreads). --- win32_threads.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/win32_threads.c b/win32_threads.c index 91d6da2a..e1c004c5 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -1686,7 +1686,12 @@ GC_INNER void GC_get_next_stack(char *start, char *limit, # if defined(GC_PTHREADS) && !defined(GC_PTHREADS_PARAMARK) /* Use pthread-based parallel mark implementation. */ -# define GC_PTHREADS_PARAMARK + + /* Workaround a deadlock in winpthreads-3.0b internals (observed */ + /* with MinGW 32/64). */ +# if !defined(__MINGW32__) +# define GC_PTHREADS_PARAMARK +# endif # endif # if !defined(GC_PTHREADS_PARAMARK) -- 2.40.0