From: Simon Marlow Date: Thu, 23 Oct 2008 15:50:17 +0000 (+0000) Subject: Fix a bug in the new scheduler X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=bd6fe3a37cefc235c5abf08557635031678d65e4;p=ghc-hetmet.git Fix a bug in the new scheduler If the current thread blocks, we should yield the Capability immediately, because the thread and hence possibly the current Task are now owned by someone else. This worked in the old scheduler, but we moved where the yield happens in the new scheduler which broke it. --- diff --git a/rts/Schedule.c b/rts/Schedule.c index 2e9d0dd..cc5cbb4 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -399,6 +399,7 @@ schedule (Capability *initialCapability, Task *task) // ASSERT_FULL_CAPABILITY_INVARIANTS(cap,task); } + yield: scheduleYield(&cap,task); if (emptyRunQueue(cap)) continue; // look for work again #endif @@ -565,7 +566,7 @@ run_thread: debugTrace(DEBUG_sched, "--<< thread %lu (%s) stopped: blocked", (unsigned long)t->id, whatNext_strs[t->what_next]); - continue; + goto yield; } #endif