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);
{
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++;
*/
release_gc_locks ();
- mono_thread_hazardous_try_free_some ();
+ sgen_try_free_some_memory = TRUE;
sgen_bridge_processing_finish (generation);