Commit 2f861d14 authored by Simon Marlow's avatar Simon Marlow
Browse files

fix bug in previous patch to this file

parent 0dbbf193
...@@ -59,16 +59,17 @@ anyWorkForMe( Capability *cap, Task *task ) ...@@ -59,16 +59,17 @@ anyWorkForMe( Capability *cap, Task *task )
// can't be sure that we have the right capability: the thread // can't be sure that we have the right capability: the thread
// might be woken up on some other capability, and task->cap // might be woken up on some other capability, and task->cap
// could change under our feet. // could change under our feet.
return (!emptyRunQueue(cap) && cap->run_queue_hd->bound == task); return !emptyRunQueue(cap) && cap->run_queue_hd->bound == task;
} else { } else {
// A vanilla worker task runs if either (a) there is a // A vanilla worker task runs if either there is a lightweight
// lightweight thread at the head of the run queue, or (b) // thread at the head of the run queue, or the run queue is
// there are sparks to execute, or (c) there is some other // empty and (there are sparks to execute, or there is some
// global condition to check, such as threads blocked on // other global condition to check, such as threads blocked on
// blackholes. // blackholes).
return ((!emptyRunQueue(cap) && cap->run_queue_hd->bound == NULL) if (emptyRunQueue(cap)) {
|| !emptySparkPoolCap(cap) return !emptySparkPoolCap(cap) || globalWorkToDo();
|| globalWorkToDo()); } else
return cap->run_queue_hd->bound == NULL;
} }
} }
#endif #endif
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment