X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmetadata%2Fsgen-stw.c;h=b6fe446cc36d28b5e8d4ca3341b342b5158007a2;hb=30305335b8295bfb9426e95443ad2e32784c154f;hp=0f52505544c9184fe56b7574180933df1e8b95e1;hpb=51927cb4192e9ab4ef42cfad8b8be638c0e615c8;p=mono.git diff --git a/mono/metadata/sgen-stw.c b/mono/metadata/sgen-stw.c index 0f52505544c..b6fe446cc36 100755 --- a/mono/metadata/sgen-stw.c +++ b/mono/metadata/sgen-stw.c @@ -147,11 +147,7 @@ restart_threads_until_none_in_managed_allocator (void) sgen_wait_for_suspend_ack (restart_count); if (sleep_duration < 0) { -#ifdef HOST_WIN32 - SwitchToThread (); -#else - sched_yield (); -#endif + mono_thread_info_yield (); sleep_duration = 0; } else { g_usleep (sleep_duration); @@ -204,13 +200,13 @@ sgen_stop_world (int generation) { int count, dead; - /*XXX this is the right stop, thought might not be the nicest place to put it*/ - sgen_process_togglerefs (); - mono_profiler_gc_event (MONO_GC_EVENT_PRE_STOP_WORLD, generation); MONO_GC_WORLD_STOP_BEGIN (); acquire_gc_locks (); + /* We start to scan after locks are taking, this ensures we won't be interrupted. */ + sgen_process_togglerefs (); + update_current_thread_stack (&count); sgen_global_stop_count++; @@ -277,7 +273,7 @@ sgen_restart_world (int generation, GGTimingInfo *timing) */ release_gc_locks (); - mono_thread_hazardous_try_free_some (); + sgen_try_free_some_memory = TRUE; sgen_bridge_processing_finish (generation);