summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rts/Schedule.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/rts/Schedule.c b/rts/Schedule.c
index 9b1e98ea17..2002b63597 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -313,7 +313,11 @@ schedule (Capability *initialCapability, Task *task)
// waiting on an async I/O to complete with WinIO.
#if defined(THREADED_RTS)
- scheduleYield(&cap,task);
+ if (emptyRunQueue(cap)) {
+ // If we have nothing to do then yield the capability and wait until we
+ // are woken up again.
+ scheduleYield(&cap,task);
+ }
if (emptyRunQueue(cap)) continue; // look for work again
#endif