[Gc] Bug in Win32 logging

Boehm, Hans hans.boehm at hp.com
Tue Sep 6 13:26:20 PDT 2005


Thanks.

I agree that this was wrong.  I applied the patch to both GC6.6 and 7.0
trees.

Hans

> -----Original Message-----
> From: gc-bounces at napali.hpl.hp.com 
> [mailto:gc-bounces at napali.hpl.hp.com] On Behalf Of Ben Hutchings
> Sent: Monday, September 05, 2005 11:36 AM
> To: GC List
> Subject: [Gc] Bug in Win32 logging
> 
> 
> We have occasionally seen the GC apparently deadlock when 
> attempting to 
> write to its log on Win32 while the world is stopped. I believe that 
> this can happen if one of the the suspended threads holds the write 
> mutex. I think this can be fixed by a change along these lines:
> 
> --- gc6.5/win32_threads.c.orig  2005-04-29 18:04:18.000000000 +0100
> +++ gc6.5/win32_threads.c       2005-09-05 19:31:44.201875000 +0100
> @@ -233,6 +233,9 @@
>  # endif
>  }
> 
> +/* Defined in misc.c */
> +extern CRITICAL_SECTION GC_write_cs;
> +
>  void GC_stop_world()
>  {
>    DWORD thread_id = GetCurrentThreadId();
> @@ -241,6 +244,7 @@
>    if (!GC_thr_initialized) ABORT("GC_stop_world() called 
> before GC_thr_init()");
> 
>    GC_please_stop = TRUE;
> +  EnterCriticalSection(&GC_write_cs);
>    for (i = 0; i <= GC_get_max_thread_index(); i++)
>      if (thread_table[i].stack_base != 0
>         && thread_table[i].id != thread_id) {
> @@ -271,6 +275,7 @@
>  #     endif
>        thread_table[i].suspended = TRUE;
>      }
> +  LeaveCriticalSection(&GC_write_cs);
>  }
> 
>  void GC_start_world()
> 
> Ben.
> 
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com 
> http://www.hpl.hp.com/hosted/linux/mail-archives/gc/
> 



More information about the Gc mailing list