From 46dfb051fef63f2778f1577ac94507833bd19481 Mon Sep 17 00:00:00 2001 From: abraunegg Date: Fri, 22 Mar 2024 08:23:01 +1100 Subject: [PATCH] Update log.d * Potentially resolve 'Aborting from core/sync/mutex.d(149) Error: pthread_mutex_destroy failed.[1] 44576 IOT instruction (core dumped)' errors --- src/log.d | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/log.d b/src/log.d index 049c46ff..21977c27 100644 --- a/src/log.d +++ b/src/log.d @@ -55,13 +55,13 @@ class LogBuffer { void shutdown() { synchronized(bufferLock) { + if (!isRunning) return; // Prevent multiple shutdowns isRunning = false; - condReady.notify(); + condReady.notifyAll(); // Wake up all waiting threads } - flushThread.join(); - flush(); + flushThread.join(); // Wait for the flush thread to finish + flush(); // Perform a final flush to ensure all data is processed } - shared void logThisMessage(string message, string[] levels = ["info"]) { // Generate the timestamp for this log entry auto timeStamp = leftJustify(Clock.currTime().toString(), 28, '0');