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

On branch  : master

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

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

commit 66839957a376dbe85608822c1820eb6c99210883
Author: Simon Marlow <[email protected]>
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;
 }
 



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to