t->saved_errno = errno;
#if mingw32_HOST_OS
// Similarly for Windows error code
- SetLastError(t->saved_winerror);
+ t->saved_winerror = GetLastError();
#endif
#if defined(THREADED_RTS)
cap->returning_tasks_tl = NULL;
#endif
+ // On Unix, all timers are reset in the child, so we need to start
+ // the timer again.
+ startTimer();
+
cap = rts_evalStableIO(cap, entry, NULL); // run the action
rts_checkSchedStatus("forkProcess",cap);