summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2012-05-16 09:56:12 +0100
committerSimon Marlow <marlowsd@gmail.com>2012-05-16 15:53:55 +0100
commit66839957a376dbe85608822c1820eb6c99210883 (patch)
tree7c984875861ef394c8b5a81b2347be98b3e66b87 /rts
parent7fe110aaf5d464b7934e1429b943d862a6da8c06 (diff)
downloadhaskell-66839957a376dbe85608822c1820eb6c99210883.tar.gz
Set the context_switch flag in yield#
yieldThread hasn't been working for a while: unless we set the context_switch flag to indicate that the current time slice is over, the RTS scheduler just runs the same thread again. Spotted by Andreas Voellmy (thanks!).
Diffstat (limited to 'rts')
-rw-r--r--rts/PrimOps.cmm5
1 files changed, 5 insertions, 0 deletions
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm
index 93ef23a71e..2ab26f7ba4 100644
--- a/rts/PrimOps.cmm
+++ b/rts/PrimOps.cmm
@@ -665,6 +665,11 @@ stg_forkOnzh
stg_yieldzh
{
+ // when we yield to the scheduler, we have to tell it to put the
+ // current thread to the back of the queue by setting the
+ // context_switch flag. If we don't do this, it will run the same
+ // thread again.
+ Capability_context_switch(MyCapability()) = 1 :: CInt;
jump stg_yield_noregs;
}