From 5d98a311e41316635327479278e3d41be54771d1 Mon Sep 17 00:00:00 2001 From: Michael Bebenita Date: Mon, 16 Aug 2010 18:44:26 -0700 Subject: Putting out the burning tree on Windows. Turns out you can completely starve threads by not yielding on windows/vmware, really weird. --- src/rt/rust_dom.cpp | 6 +++--- src/rt/sync/sync.cpp | 2 +- src/rt/sync/timer.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/rt') diff --git a/src/rt/rust_dom.cpp b/src/rt/rust_dom.cpp index 1d067560..e49eeb22 100644 --- a/src/rt/rust_dom.cpp +++ b/src/rt/rust_dom.cpp @@ -400,9 +400,9 @@ rust_dom::start_main_loop() rust_task *scheduled_task = schedule_task(); - // If we cannot schedule a task because all other live tasks - // are blocked, yield and hopefully some progress is made in - // other domains. + // The scheduler busy waits until a task is available for scheduling. + // Eventually we'll want a smarter way to do this, perhaps sleep + // for a minimum amount of time. if (scheduled_task == NULL) { if (_log.is_tracing(rust_log::TASK)) { diff --git a/src/rt/sync/sync.cpp b/src/rt/sync/sync.cpp index eba51a49..09a6f291 100644 --- a/src/rt/sync/sync.cpp +++ b/src/rt/sync/sync.cpp @@ -5,7 +5,7 @@ void sync::yield() { #ifdef __APPLE__ pthread_yield_np(); #elif __WIN32__ - + Sleep(1); #else pthread_yield(); #endif diff --git a/src/rt/sync/timer.cpp b/src/rt/sync/timer.cpp index e45dd633..0487b397 100644 --- a/src/rt/sync/timer.cpp +++ b/src/rt/sync/timer.cpp @@ -6,12 +6,12 @@ #endif timer::timer() { - reset(0); #if __WIN32__ uint64_t ticks_per_second; QueryPerformanceFrequency((LARGE_INTEGER *)&ticks_per_second); _ticks_per_us = ticks_per_second / 1000000; #endif + reset(0); } void -- cgit v1.2.3