From 318e0005b5a3a522854ced7162f3eee95f964bd9 Mon Sep 17 00:00:00 2001 From: Ben Gamari <ben@smart-cactus.org> Date: Thu, 21 Apr 2022 14:42:19 -0400 Subject: [PATCH] rts/eventlog: Don't attempt to flush if there is no writer If the user has not configured a writer then there is nothing to flush. --- rts/eventlog/EventLog.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rts/eventlog/EventLog.c b/rts/eventlog/EventLog.c index d67f9e7bb1cf..ff3229298c2e 100644 --- a/rts/eventlog/EventLog.c +++ b/rts/eventlog/EventLog.c @@ -1542,6 +1542,10 @@ void flushLocalEventsBuf(Capability *cap) // Used during forkProcess. void flushAllCapsEventsBufs() { + if (!event_log_writer) { + return; + } + ACQUIRE_LOCK(&eventBufMutex); printAndClearEventBuf(&eventBuf); RELEASE_LOCK(&eventBufMutex); @@ -1554,6 +1558,10 @@ void flushAllCapsEventsBufs() void flushEventLog(Capability **cap USED_IF_THREADS) { + if (!event_log_writer) { + return; + } + ACQUIRE_LOCK(&eventBufMutex); printAndClearEventBuf(&eventBuf); RELEASE_LOCK(&eventBufMutex); -- GitLab