diff options
author | Simon Marlow <marlowsd@gmail.com> | 2008-10-23 15:50:17 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2008-10-23 15:50:17 +0000 |
commit | bd6fe3a37cefc235c5abf08557635031678d65e4 (patch) | |
tree | 3f6ae27ec2bc8fa30c398f8392e8e2d3c27a10d4 | |
parent | a4326c0e87499dd633c55625f325244b1caf337a (diff) | |
download | haskell-bd6fe3a37cefc235c5abf08557635031678d65e4.tar.gz |
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.
-rw-r--r-- | rts/Schedule.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/rts/Schedule.c b/rts/Schedule.c index 2e9d0dda77..cc5cbb476f 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 |