diff options
author | Andreas Klebinger <klebinger.andreas@gmx.at> | 2020-04-20 16:21:27 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2020-07-15 16:41:02 -0400 |
commit | 4c026b6cf5eb25651f656833e4d312621866330d (patch) | |
tree | db3a8298799969fc2d335e9dc04e1eed0a781ea8 /rts/Schedule.c | |
parent | 2fc957c52270d93073b7ed9fe42ac51fcd749a45 (diff) | |
download | haskell-4c026b6cf5eb25651f656833e4d312621866330d.tar.gz |
winio: nonthreaded: Create io processing threads in main thread.
We now set a flag in the IO thread. The scheduler when looking for work
will check the flag and create/queue threads accordingly.
We used to create these in the IO thread. This improved performance
but caused frequent segfaults. Thread creation/allocation is only safe to
do if nothing currently accesses the storeagemanager. However without
locks in the non-threaded runtime this can't be guaranteed.
This shouldn't change performance all too much.
In the past we had:
* IO: Create/Queue thread.
* Scheduler: Runs a few times. Eventually picks up IO processing thread.
Now it's:
* IO: Set flag to queue thread.
* Scheduler: Pick up flag, if set create/queue thread. Eventually picks up IO processing thread.
Diffstat (limited to 'rts/Schedule.c')
-rw-r--r-- | rts/Schedule.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/rts/Schedule.c b/rts/Schedule.c index 1d703bdf21..8c120c093e 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -34,6 +34,7 @@ #include "AwaitEvent.h" #if defined(mingw32_HOST_OS) #include "win32/IOManager.h" +#include "win32/AsyncWinIO.h" #endif #include "Trace.h" #include "RaiseAsync.h" @@ -635,6 +636,9 @@ schedulePreLoop(void) static void scheduleFindWork (Capability **pcap) { +#if defined(mingw32_HOST_OS) && !defined(THREADED_RTS) + queueIOThread(); +#endif scheduleStartSignalHandlers(*pcap); scheduleProcessInbox(pcap); |