Browse Source

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.
v1.13.0-BW
Beat Küng 3 years ago committed by Daniel Agar
parent
commit
b091ea9fd9
No known key found for this signature in database
GPG Key ID: FD3CBA98017A69DE
  1. 2
      src/modules/logger/log_writer_file.cpp

2
src/modules/logger/log_writer_file.cpp

@ -484,7 +484,7 @@ void LogWriterFile::run() @@ -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);
}
}

Loading…
Cancel
Save