-/*
- * Sigh - to avoid requiring anyone that wants to build ghc to have
- * to augment the Win32 header files that comes with cygwinb20.1,
- * include the missing MM API decls here inline.
- *
- * ToDo: check and remove these once the next version of cygwin is
- * released.
- */
-#define TIMERR_NOERROR 0
-#define TIMERR_NOCANDO 97
-#define TIME_PERIODIC 1
-
-typedef UINT MMRESULT;
-typedef void CALLBACK (*TIMECALLBACK) (UINT, UINT, DWORD, DWORD, DWORD);
-typedef TIMECALLBACK *LPTIMECALLBACK;
-MMRESULT STDCALL timeSetEvent(UINT, UINT, LPTIMECALLBACK, DWORD, UINT);
-/*
- vtalrm_handler is assigned and set up in Signals.c
-
- vtalrm_id (defined in Signals.c) holds
- the system id for the current timer (used to
- later block/kill it.)
-*/
-extern nat vtalrm_id;
-TIMECALLBACK *vtalrm_cback;
-
-nat
-initialize_virtual_timer(nat ms)
-{
-# ifdef PROFILING
- /* On Win32 setups that don't have support for
- setitimer(), we use the MultiMedia API's timer
- support.
-
- As the delivery of ticks isn't free, we only
- enable it if we really needed, i.e., when profiling.
- (the RTS now also needs timer ticks to implement
- threadDelay in non-profiling mode, but the pure
- Win32 port doesn't support that.....yet.)
- */
- unsigned int delay,vtalrm_id;
-
- delay = timeBeginPeriod(1);
- if (delay == TIMERR_NOCANDO) { /* error of some sort. */
- return delay;
- }
- vtalrm_id =
- timeSetEvent(ms, /* event every `delay' milliseconds. */
- 1, /* precision is within 5 millisecs. */
- (LPTIMECALLBACK)vtalrm_cback,
- 0,
- TIME_PERIODIC);