[commit: ghc] master: Set the context_switch flag in yield# (6683995)

Simon Marlow marlowsd at gmail.com
Wed May 16 16:54:06 CEST 2012


Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/66839957a376dbe85608822c1820eb6c99210883

>---------------------------------------------------------------

commit 66839957a376dbe85608822c1820eb6c99210883
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Wed May 16 09:56:12 2012 +0100

    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!).

>---------------------------------------------------------------

 rts/PrimOps.cmm |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm
index 93ef23a..2ab26f7 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;
 }
 





More information about the Cvs-ghc mailing list