summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-05-09 14:02:02 -0400
committerBen Gamari <ben@smart-cactus.org>2022-05-09 15:24:15 -0400
commitff24f56984c6afb802176bbdc8338235594c5f7c (patch)
tree35e35681f1d846ce4e33527b7abe0cf8d65975c1
parent67072c31d8b6ce4f0de79fa52bc3e5cdd5a495c6 (diff)
downloadhaskell-wip/T21539.tar.gz
rts/schedule: Only yield capability if run queue is emptywip/T21539
-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