summaryrefslogtreecommitdiff
path: root/rts/win32/Ticker.c
diff options
context:
space:
mode:
authorSimon Marlow <simonmar@microsoft.com>2007-03-02 11:31:04 +0000
committerSimon Marlow <simonmar@microsoft.com>2007-03-02 11:31:04 +0000
commite30aca19def5c629a8429bd57e56535b7f8f85c8 (patch)
tree64513fe1bd809cb0e8442df826a03fb73c324103 /rts/win32/Ticker.c
parent090bff7e86dbad7c429532994f3f2fe9d4d8b8ea (diff)
downloadhaskell-e30aca19def5c629a8429bd57e56535b7f8f85c8.tar.gz
Use timer_create() for the interval timer, if available
This lets the threaded RTS use SIGVTALRM rather than SIGALRM for its interval timer signal, so the threaded and non-threaded RTS are compatible. It unfortunately doesn't completely fix #850/#1156, for that we really have to use a restartable sleep instead of usleep(). Also I cleaned up the timer API a little: instead of returning an error value that ultimately gets ignored, we now report errors from system calls and exit.
Diffstat (limited to 'rts/win32/Ticker.c')
-rw-r--r--rts/win32/Ticker.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/rts/win32/Ticker.c b/rts/win32/Ticker.c
index 7701a3b275..5b41494d47 100644
--- a/rts/win32/Ticker.c
+++ b/rts/win32/Ticker.c
@@ -74,7 +74,7 @@ TimerProc(PVOID param)
}
-int
+void
startTicker(nat ms, TickProc handle_tick)
{
unsigned threadId;
@@ -95,10 +95,14 @@ startTicker(nat ms, TickProc handle_tick)
(LPVOID)ms,
0,
&threadId);
- return (tickThread != 0);
+
+ if (tickThread == 0) {
+ sysErrorBelch("_beginthreadex");
+ stg_exit(EXIT_FAILURE);
+ }
}
-int
+void
stopTicker(void)
{
// We must wait for the ticker thread to terminate, since if we
@@ -125,5 +129,4 @@ stopTicker(void)
TerminateThread(tickThread, 0);
}
}
- return 0;
}