From b091ea9fd94939e2f61b5df9b311cd9ac6a546c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Mon, 9 May 2022 16:55:31 +0200 Subject: [PATCH] log_writer_file: fix corner case when mission log is enabled Normally _should_run for mission is only ever true if _should_run for the normal log is. There are exceptions though: - the log buffer fails to allocate - there was a write failure (e.g. due to SD card removal) In that situation, the writer would not wait anymore but busy-loop. --- src/modules/logger/log_writer_file.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/logger/log_writer_file.cpp b/src/modules/logger/log_writer_file.cpp index e6453a8080..e4f1787fb6 100644 --- a/src/modules/logger/log_writer_file.cpp +++ b/src/modules/logger/log_writer_file.cpp @@ -484,7 +484,7 @@ void LogWriterFile::run() * not an issue because notify() is called regularly. * If the logger was switched off in the meantime, do not wait for data, instead run this loop * once more to write remaining data and close the file. */ - if (_buffers[0]._should_run) { + if (_buffers[0]._should_run || _buffers[1]._should_run) { pthread_cond_wait(&_cv, &_mtx); } }