summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-04-21 14:42:19 -0400
committerMatthew Pickering <matthewtpickering@gmail.com>2022-05-30 18:07:25 +0100
commitcd804f6b7fa0e6843d6eb2b892aa31d63a2f1d60 (patch)
treee6fccc9d6b386ccf3d747d74cd5c958ca0149ea9 /rts
parentbe7d367f544e160bcf905cbac259756f3c4145b6 (diff)
downloadhaskell-cd804f6b7fa0e6843d6eb2b892aa31d63a2f1d60.tar.gz
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. (cherry picked from commit 318e0005b5a3a522854ced7162f3eee95f964bd9)
Diffstat (limited to 'rts')
-rw-r--r--rts/eventlog/EventLog.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/rts/eventlog/EventLog.c b/rts/eventlog/EventLog.c
index d67f9e7bb1..ff3229298c 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);