summaryrefslogtreecommitdiff
path: root/rts/Schedule.c
diff options
context:
space:
mode:
authorSimon Marlow <simonmar@microsoft.com>2006-12-01 14:48:23 +0000
committerSimon Marlow <simonmar@microsoft.com>2006-12-01 14:48:23 +0000
commit80a766fdb6864eae613962e43ad9eb371e0ce80c (patch)
tree85bb6589d0b8f138b721f01d4b5337ff87ba9b11 /rts/Schedule.c
parentde6c8e5293c9ef68b597ab2e6d55c3f42a283489 (diff)
downloadhaskell-80a766fdb6864eae613962e43ad9eb371e0ce80c.tar.gz
Add support for the IO manager thread on Windows
Fixes #637. The implications of this change are: - threadDelay on Windows no longer creates a new OS thread each time, instead it communicates with the IO manager thread in the same way as on Unix. - deadlock detection now works the same way on Windows as on Unix; that is the timer interrupt wakes up the IO manager thread, which causes the scheduler to check for deadlock. - Console events now get sent to the IO manager thread, in the same way as signals do on Unix. This means that console events should behave more reliably with -threaded on Windows. All this applies only with -threaded. Without -threaded, the old ConsoleEvent code is still used. After some testing, this could be pushed to the 6.6 branch.
Diffstat (limited to 'rts/Schedule.c')
-rw-r--r--rts/Schedule.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/rts/Schedule.c b/rts/Schedule.c
index 0a46ec5144..cf62c5ae7a 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -51,6 +51,7 @@
#include "Trace.h"
#include "RaiseAsync.h"
#include "Threads.h"
+#include "ThrIOManager.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
@@ -849,7 +850,7 @@ schedulePushWork(Capability *cap USED_IF_THREADS,
* Start any pending signal handlers
* ------------------------------------------------------------------------- */
-#if defined(RTS_USER_SIGNALS) && (!defined(THREADED_RTS) || defined(mingw32_HOST_OS))
+#if defined(RTS_USER_SIGNALS) && !defined(THREADED_RTS)
static void
scheduleStartSignalHandlers(Capability *cap)
{
@@ -971,7 +972,7 @@ scheduleDetectDeadlock (Capability *cap, Task *task)
if ( !emptyRunQueue(cap) ) return;
-#if defined(RTS_USER_SIGNALS) && (!defined(THREADED_RTS) || defined(mingw32_HOST_OS))
+#if defined(RTS_USER_SIGNALS) && !defined(THREADED_RTS)
/* If we have user-installed signal handlers, then wait
* for signals to arrive rather then bombing out with a
* deadlock.
@@ -2820,17 +2821,10 @@ void
wakeUpRts(void)
{
#if defined(THREADED_RTS)
-#if !defined(mingw32_HOST_OS)
// This forces the IO Manager thread to wakeup, which will
// in turn ensure that some OS thread wakes up and runs the
// scheduler loop, which will cause a GC and deadlock check.
ioManagerWakeup();
-#else
- // On Windows this might be safe enough, because we aren't
- // in a signal handler. Later we should use the IO Manager,
- // though.
- prodOneCapability();
-#endif
#endif
}