forked from Archive/PX4-Autopilot
logger: fix thread deadlock
This commit is contained in:
parent
4698a09b98
commit
d7a9b123e6
|
@ -295,8 +295,12 @@ void LogWriterFile::run()
|
||||||
/* Wait for a call to notify(), which indicates new data is available.
|
/* Wait for a call to notify(), which indicates new data is available.
|
||||||
* Note that at this point there could already be new data available (because of a longer write),
|
* Note that at this point there could already be new data available (because of a longer write),
|
||||||
* and calling pthread_cond_wait() will still wait for the next notify(). But this is generally
|
* and calling pthread_cond_wait() will still wait for the next notify(). But this is generally
|
||||||
* not an issue because notify() is called regularly. */
|
* not an issue because notify() is called regularly.
|
||||||
pthread_cond_wait(&_cv, &_mtx);
|
* 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) {
|
||||||
|
pthread_cond_wait(&_cv, &_mtx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// go back to idle
|
// go back to idle
|
||||||
|
|
Loading…
Reference in New Issue