Skip to content

Commit

Permalink
Set the context_switch flag in yield#
Browse files Browse the repository at this point in the history
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!).
  • Loading branch information
simonmar committed May 16, 2012
1 parent 7fe110a commit 6683995
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions rts/PrimOps.cmm
Expand Up @@ -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;
}

Expand Down

0 comments on commit 6683995

Please sign in to comment.