Fix double lock in pthread_detach (Cygwin, winpthreads)
authorIvan Maidanski <ivmai@mail.ru>
Mon, 25 Sep 2017 22:12:30 +0000 (01:12 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 25 Sep 2017 22:12:30 +0000 (01:12 +0300)
* win32_threads.c [GC_PTHREADS] (GC_pthread_detach): Do not hold the
allocation lock when GC_lookup_pthread is invoked.

win32_threads.c

index a99eec1..24f16db 100644 (file)
@@ -2715,9 +2715,7 @@ GC_INNER void GC_thr_init(void)
     DCL_LOCK_STATE;
 
     GC_ASSERT(!GC_win32_dll_threads);
-    LOCK();
     t = GC_lookup_pthread(thread);
-    UNLOCK();
     result = pthread_detach(thread);
     if (result == 0) {
       if (NULL == t) ABORT("Thread not registered");