Use SwitchToThread instead of sched_yield on Windows.
authorjoncham <joncham@gmail.com>
Fri, 22 Apr 2011 01:01:05 +0000 (21:01 -0400)
committerjoncham <joncham@gmail.com>
Fri, 22 Apr 2011 01:28:20 +0000 (21:28 -0400)
mono/utils/mono-threads.c

index 19656c933163517b25be0b1d01dcf61f2e819eca..d2632f3d6ee218ccecbafd389185cd7f2cc1a8d7 100644 (file)
@@ -378,10 +378,16 @@ mono_thread_info_safe_suspend_sync (MonoNativeThreadId id, gboolean interrupt_ke
                }
                THREADS_DEBUG ("restarted thread %p\n", (gpointer)id);
 
-               if (!sleep_duration)
+               if (!sleep_duration) {
+#ifdef HOST_WIN32
+                       SwitchToThread ();
+#else
                        sched_yield ();
-               else
+#endif
+               }
+               else {
                        g_usleep (sleep_duration);
+               }
                sleep_duration += 10;
        }