summaryrefslogtreecommitdiff
path: root/rts/Schedule.c
diff options
context:
space:
mode:
authorDuncan Coutts <duncan@well-typed.com>2021-12-14 16:13:51 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-11-22 02:06:17 -0500
commit39a91f60d958247cffdd6e10ac58030bc72ce464 (patch)
tree1e294d5bba420be2f6b895dd7025fad16bcf00b7 /rts/Schedule.c
parent0f68919ee6ef7ed77c79008e9e807d39919fadc0 (diff)
downloadhaskell-39a91f60d958247cffdd6e10ac58030bc72ce464.tar.gz
Move macros for checking for pending IO or timers
from Schedule.h to Schedule.c and IOManager.h This is just moving, the next step will be to rejig them slightly. For the non-threaded RTS the scheduler needs to be able to test for there being pending I/O operation or pending timers. The implementation of these tests should really be considered to be part of the I/O managers and not part of the scheduler.
Diffstat (limited to 'rts/Schedule.c')
-rw-r--r--rts/Schedule.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/rts/Schedule.c b/rts/Schedule.c
index 67e2ff4ee8..5d3789c31d 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -143,6 +143,7 @@ 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);
@@ -167,6 +168,7 @@ static void deleteAllThreads (void);
static void deleteThread_(StgTSO *tso);
#endif
+
/* ---------------------------------------------------------------------------
Main scheduling loop.
@@ -916,6 +918,18 @@ scheduleCheckBlockedThreads(Capability *cap USED_IF_NOT_THREADS)
#endif
}
+static bool
+emptyThreadQueues(Capability *cap)
+{
+ return emptyRunQueue(cap)
+#if !defined(THREADED_RTS)
+ // TODO replace this by a test that deferrs to the active I/O manager
+ && EMPTY_BLOCKED_QUEUE(cap) && EMPTY_SLEEPING_QUEUE(cap)
+#endif
+ ;
+}
+
+
/* ----------------------------------------------------------------------------
* Detect deadlock conditions and attempt to resolve them.
* ------------------------------------------------------------------------- */