diff options
| author | Simon Peyton Jones <simonpj@microsoft.com> | 2012-09-28 15:53:45 +0100 |
|---|---|---|
| committer | Simon Peyton Jones <simonpj@microsoft.com> | 2012-09-28 15:53:45 +0100 |
| commit | 6e3e64aeda1add215ffccca87931a60e4f8b53e5 (patch) | |
| tree | a8cc5dd835ed86fb02f746969cf0cb376942f6b2 /rts/Timer.c | |
| parent | 9a058b173a6e12296ac302a6ccd22d9c8f0a09d0 (diff) | |
| parent | 42cb30bd2c00705da598cc8d4170b41fb5693166 (diff) | |
| download | haskell-6e3e64aeda1add215ffccca87931a60e4f8b53e5.tar.gz | |
Merge remote-tracking branch 'origin/master' into tc-untouchables
Diffstat (limited to 'rts/Timer.c')
| -rw-r--r-- | rts/Timer.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/rts/Timer.c b/rts/Timer.c index 3f9bc8ab0c..aa4b8d8fd7 100644 --- a/rts/Timer.c +++ b/rts/Timer.c @@ -28,10 +28,8 @@ /* ticks left before next pre-emptive context switch */ static int ticks_to_ctxt_switch = 0; -#if defined(THREADED_RTS) /* idle ticks left before we perform a GC */ static int ticks_to_gc = 0; -#endif /* * Function: handle_tick() @@ -52,8 +50,7 @@ handle_tick(int unused STG_UNUSED) } } -#if defined(THREADED_RTS) - /* + /* * If we've been inactive for idleGCDelayTime (set by +RTS * -I), tell the scheduler to wake up and do a GC, to check * for threads that are deadlocked. @@ -66,24 +63,28 @@ handle_tick(int unused STG_UNUSED) break; case ACTIVITY_MAYBE_NO: if (ticks_to_gc == 0) { - /* 0 ==> no idle GC */ - recent_activity = ACTIVITY_DONE_GC; - // disable timer signals (see #1623) - stopTimer(); - } else { - ticks_to_gc--; - if (ticks_to_gc == 0) { - ticks_to_gc = RtsFlags.GcFlags.idleGCDelayTime / - RtsFlags.MiscFlags.tickInterval; + if (RtsFlags.GcFlags.doIdleGC) { recent_activity = ACTIVITY_INACTIVE; +#ifdef THREADED_RTS wakeUpRts(); + // The scheduler will call stopTimer() when it has done + // the GC. +#endif + } else { + recent_activity = ACTIVITY_DONE_GC; + // disable timer signals (see #1623, #5991) + // but only if we're not profiling +#ifndef PROFILING + stopTimer(); +#endif } + } else { + ticks_to_gc--; } break; default: break; } -#endif } // This global counter is used to allow multiple threads to stop the |
