summaryrefslogtreecommitdiff
path: root/rts/IOManager.h
diff options
context:
space:
mode:
authorDuncan Coutts <duncan@well-typed.com>2021-01-03 18:06:07 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-01-25 05:11:14 -0500
commitd345d3befe40cd265b9309f10c0aea057b2dd249 (patch)
treee1778144443ec2eace5189ba9a33c5c1779f5436 /rts/IOManager.h
parent4ad726fc1a5d062e2df2910d7f39ab81428dddfc (diff)
downloadhaskell-d345d3befe40cd265b9309f10c0aea057b2dd249.tar.gz
Replace a direct call to ioManagerStartCap with a new hook
Replace a direct call to ioManagerStartCap in the forkProcess in Schedule.c with a new hook initIOManagerAfterFork in IOManager. This replaces a direct hook in the scheduler from the a single I/O manager impl (the threaded unix one) with a generic hook. Add some commentrary on opportunities for future rationalisation.
Diffstat (limited to 'rts/IOManager.h')
-rw-r--r--rts/IOManager.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/rts/IOManager.h b/rts/IOManager.h
index be9bc3ab1a..3a66760258 100644
--- a/rts/IOManager.h
+++ b/rts/IOManager.h
@@ -25,6 +25,18 @@
*/
void initIOManager(void);
+/* Init hook: called from forkProcess in the child process on the surviving
+ * capability.
+ *
+ * Note that this is synchronous and can run Haskell code, so can change the
+ * given cap.
+ */
+void initIOManagerAfterFork(/* inout */ Capability **pcap);
+
+/* TODO: rationalise initIOManager and initIOManagerAfterFork into a single
+ per-capability init function.
+ */
+
/* Shutdown hooks: called from hs_exit_ before and after the scheduler exits.
*/
@@ -52,4 +64,11 @@ void ioManagerStart (void);
#define USED_IF_NOT_THREADS_AND_MINGW32 STG_UNUSED
#endif
+#if defined(THREADED_RTS) && !defined(mingw32_HOST_OS)
+#define USED_IF_THREADS_AND_NOT_MINGW32
+#else
+#define USED_IF_THREADS_AND_NOT_MINGW32 STG_UNUSED
+#endif
+
+
#include "EndPrivate.h"