diff options
author | Duncan Coutts <duncan@well-typed.com> | 2021-12-15 01:24:54 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-11-22 02:06:17 -0500 |
commit | 3294622041192df4e9ed004097fabd70932634a4 (patch) | |
tree | 301845239ea98d49d6c6344dcd1315d3a33b8937 | |
parent | 664b034b8403c8623eec0b7f1ce41d0aaede5edb (diff) | |
download | haskell-3294622041192df4e9ed004097fabd70932634a4.tar.gz |
Expand emptyThreadQueues inline for clarity
It was not really adding anything. The name no longer meant anything
since those I/O and timeout queues do not belong to the scheuler.
In one of the two places it was used, the comments already had to
explain what it did, whereas now the code matches the comment nicely.
-rw-r--r-- | rts/Schedule.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/rts/Schedule.c b/rts/Schedule.c index 18ceae927b..2b25c96b71 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -143,7 +143,6 @@ static void startWorkerTasks (uint32_t from USED_IF_THREADS, #endif static void scheduleStartSignalHandlers (Capability *cap); static void scheduleCheckBlockedThreads (Capability *cap); -static bool emptyThreadQueues(Capability *cap); static void scheduleProcessInbox(Capability **cap); static void scheduleDetectDeadlock (Capability **pcap, Task *task); static void schedulePushWork(Capability *cap, Task *task); @@ -399,8 +398,9 @@ schedule (Capability *initialCapability, Task *task) * the user specified "context switch as often as possible", with * +RTS -C0 */ - if (RtsFlags.ConcFlags.ctxtSwitchTicks == 0 - && !emptyThreadQueues(cap)) { + if (RtsFlags.ConcFlags.ctxtSwitchTicks == 0 && + (!emptyRunQueue(cap) || + anyPendingTimeoutsOrIO(cap->iomgr))) { RELAXED_STORE(&cap->context_switch, 1); } @@ -918,14 +918,6 @@ scheduleCheckBlockedThreads(Capability *cap USED_IF_NOT_THREADS) #endif } -static bool -emptyThreadQueues(Capability *cap) -{ - return emptyRunQueue(cap) - && !anyPendingTimeoutsOrIO(cap->iomgr); -} - - /* ---------------------------------------------------------------------------- * Detect deadlock conditions and attempt to resolve them. * ------------------------------------------------------------------------- */ @@ -940,7 +932,7 @@ scheduleDetectDeadlock (Capability **pcap, Task *task) * other tasks are waiting for work, we must have a deadlock of * some description. */ - if ( emptyThreadQueues(cap) ) + if ( emptyRunQueue(cap) && !anyPendingTimeoutsOrIO(cap->iomgr) ) { #if defined(THREADED_RTS) /* |