From 00a4cdf7db3ac722db2346416a1b3b891dbc9a0a Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Fri, 10 Dec 2010 09:39:51 +0000 Subject: [PATCH] Only reset the event log if logging is turned on (addendum to #4512) --- rts/Schedule.c | 8 ++++---- rts/Trace.c | 8 ++++++++ rts/Trace.h | 1 + 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/rts/Schedule.c b/rts/Schedule.c index bf39c0a..0b1dec4 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -1566,11 +1566,11 @@ forkProcess(HsStablePtr *entry initMutex(&cap->running_task->lock); #endif -#if defined(TRACING) - abortEventLogging(); // abort eventlog inherited from parent - initEventLogging(); // child starts its own eventlog +#ifdef TRACING + resetTracing(); #endif - // Now, all OS threads except the thread that forked are + + // Now, all OS threads except the thread that forked are // stopped. We need to stop all Haskell threads, including // those involved in foreign calls. Also we need to delete // all Tasks, because they correspond to OS threads that are diff --git a/rts/Trace.c b/rts/Trace.c index be3fff7..53fc25a 100644 --- a/rts/Trace.c +++ b/rts/Trace.c @@ -106,6 +106,14 @@ void freeTracing (void) } } +void resetTracing (void) +{ + if (eventlog_enabled) { + abortEventLogging(); // abort eventlog inherited from parent + initEventLogging(); // child starts its own eventlog + } +} + /* --------------------------------------------------------------------------- Emitting trace messages/events --------------------------------------------------------------------------- */ diff --git a/rts/Trace.h b/rts/Trace.h index 4f3ebce..97d9514 100644 --- a/rts/Trace.h +++ b/rts/Trace.h @@ -27,6 +27,7 @@ void initTracing (void); void endTracing (void); void freeTracing (void); +void resetTracing (void); #endif /* TRACING */ -- 1.7.10.4