summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Coutts <duncan@well-typed.com>2022-10-17 10:53:22 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-11-22 02:06:17 -0500
commit7181b0742fec878137b1fcb7c3a86c4a95e3da47 (patch)
tree7132ff53f76214c0c1c1e2a2e0c931e1697d3192
parent667fe5a471378124fecc149373bb25bf16771d17 (diff)
downloadhaskell-7181b0742fec878137b1fcb7c3a86c4a95e3da47.tar.gz
Reveiew feedback: improve one of the TODO comments
The one about the nonsense (const False) test on WinIO for there being any IO or timers pending, leading to unnecessary complication later in the scheduler.
-rw-r--r--rts/Schedule.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/rts/Schedule.c b/rts/Schedule.c
index 1f95c9e8f8..d4b1bf345f 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -912,12 +912,20 @@ scheduleCheckBlockedThreads(Capability *cap USED_IF_NOT_THREADS)
* TODO: see if we can rationalise these two awaitEvent calls before
* and after scheduleDetectDeadlock()
*
- * TODO: these empty-queue tests are highly dubious because they only make
- * sense for some I/O managers. The sleeping_queue is _only_ used by the
- * select() I/O manager. The WinIO I/O manager does not use either the
- * sleeping_queue or the blocked_queue, so both queues will _always_ be
- * empty and so awaitEvent will _never_ be called here for WinIO. This may
- * explain why there is a second call to awaitEvent below for mingw32.
+ * TODO: this test anyPendingTimeoutsOrIO does not have a proper
+ * implementation the WinIO I/O manager!
+ *
+ * The select() I/O manager uses the sleeping_queue and the blocked_queue,
+ * and the test checks both. The legacy win32 I/O manager only consults
+ * the blocked_queue, but then it puts threads waiting on delay# on the
+ * blocked_queue too, so that's ok.
+ *
+ * The WinIO I/O manager does not use either the sleeping_queue or the
+ * blocked_queue, but it's implementation of anyPendingTimeoutsOrIO still
+ * checks both! Since both queues will _always_ be empty then it will
+ * _always_ return false and so awaitEvent will _never_ be called here for
+ * WinIO. This may explain why there is a second call to awaitEvent below
+ * for the case of !defined(THREADED_RTS) && defined(mingw32_HOST_OS).
*/
if (anyPendingTimeoutsOrIO(cap->iomgr))
{