Merge pull request #82 from Unity-Technologies/master-gc-race
authorRodrigo Kumpera <kumpera@gmail.com>
Thu, 12 May 2011 19:01:48 +0000 (12:01 -0700)
committerRodrigo Kumpera <kumpera@gmail.com>
Thu, 12 May 2011 19:01:48 +0000 (12:01 -0700)
[Fix] Fix intermittent initialization race crash with boehm gc.

1  2 
mono/metadata/boehm-gc.c

index 1112bb283cf8685a4adc5d329839bce94a60f7d4,495827be66b43d366da0639a3ba566fb67d02398..2055a64e0b7e6e12369b2847d2e97bfc4f45bb3c
@@@ -390,13 -375,9 +390,14 @@@ on_gc_notification (GCEventType event
  {
        MonoGCEvent e = (MonoGCEvent)event;
  
 +      if (e == MONO_GC_EVENT_PRE_STOP_WORLD) 
 +              mono_thread_info_suspend_lock ();
 +      else if (e == MONO_GC_EVENT_POST_START_WORLD)
 +              mono_thread_info_suspend_unlock ();
 +      
        if (e == MONO_GC_EVENT_START) {
-               mono_perfcounters->gc_collections0++;
+               if (mono_perfcounters)
+                       mono_perfcounters->gc_collections0++;
                mono_stats.major_gc_count ++;
                gc_start_time = mono_100ns_ticks ();
        } else if (e == MONO_GC_EVENT_END) {