summaryrefslogtreecommitdiff
path: root/rts/IOManager.h
diff options
context:
space:
mode:
authorDuncan Coutts <duncan@well-typed.com>2020-12-29 17:39:19 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-11-22 02:06:17 -0500
commitced9acdbe757331d8d0046df30a06e61b05dd204 (patch)
tree52f6796b25bf23c5eeaa0b88e4b794b09d30386a /rts/IOManager.h
parent5cf709c541a46a17ef2e36d589ba13d949d058e1 (diff)
downloadhaskell-ced9acdbe757331d8d0046df30a06e61b05dd204.tar.gz
Move {blocked,sleeping}_queue from scheduler global vars to CapIOManager
The blocked_queue_{hd,tl} and the sleeping_queue are currently cooperatively managed between the scheduler and (some but not all of) the non-threaded I/O manager implementations. They lived as global vars with the scheduler, but are poked by I/O primops and the I/O manager backends. This patch is a step on the path towards making the management of I/O or timer blocking belong to the I/O managers and not the scheduler. Specifically, this patch moves the {blocked,sleeping}_queue from being global vars in the scheduler to being members of the CapIOManager struct within each Capability. They are not yet exclusively used by the I/O managers: they are still poked from a couple other places, notably in the scheduler before calling awaitEvent.
Diffstat (limited to 'rts/IOManager.h')
-rw-r--r--rts/IOManager.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/rts/IOManager.h b/rts/IOManager.h
index f1d8cfe5c2..515cfc2f85 100644
--- a/rts/IOManager.h
+++ b/rts/IOManager.h
@@ -43,6 +43,22 @@ typedef struct {
/* Control FD for the MIO manager for this capability */
int control_fd;
#endif
+#else // !defined(THREADED_RTS)
+ /* Thread queue for threads blocked on I/O completion.
+ * Used by the select() and Win32 MIO I/O managers. It is not used by
+ * the WinIO I/O manager, though it remains defined in this case.
+ */
+ StgTSO *blocked_queue_hd;
+ StgTSO *blocked_queue_tl;
+
+ /* Thread queue for threads blocked on timeouts.
+ * Used by the select() I/O manager only. It is grossly inefficient, like
+ * everything else to do with the select() I/O manager.
+ *
+ * TODO: It is not used by any of the Windows I/O managers, though it
+ * remains defined for them. This is an oddity that should be resolved.
+ */
+ StgTSO *sleeping_queue;
#endif
} CapIOManager;