Skip to content
  • Simon Marlow's avatar
    [project @ 2005-05-23 15:44:10 by simonmar] · 6d16c476
    Simon Marlow authored
    Simplify and improve the Capability-passing machinery for bound
    threads.
    
    The old story was quite complicated: if you find a thread on the run
    queue which the current task can't run, you had to call
    passCapability(), which set a flag saying where the next Capability
    was to go, and then release the Capability.  When multiple
    Capabilities are flying around, it's not clear how this story should
    extend.
    
    The new story is much simpler: each time around the scheduler loop,
    the task looks to see whether it can make any progress, and if not, it
    releases its Capability and wakes up a task which *can* make some
    progress.  The predicate for whether we can make any progress is
    encapsulated in the (inline) function ANY_WORK_FOR_ME(Condition).
    Waking up an appropriate task is encapsulated in the function
    threadRunnable() (previously it was in two places).
    
    The logic in Capability.c is simpler, but unfortunately it is now more
    closely connected with the Scheduler, because it inspects the run
    queue.  However, performance when communicating between bound and
    unbound threads might be better.
    
    The concurrency tests still work, so hopefully this hasn't broken
    anything.
    6d16c476