logger: proper error handling if writer thread creation fails

This commit is contained in:
Beat Küng
2016-05-02 14:44:45 +02:00
committed by Lorenz Meier
parent 72263eaa97
commit 84015e5c01
3 changed files with 16 additions and 11 deletions

View File

@@ -402,7 +402,12 @@ void Logger::run()
// add_topic("estimator_status");
add_topic("vehicle_status", 100);
_writer_thread = _writer.thread_start();
int ret = _writer.thread_start(_writer_thread);
if (ret) {
PX4_ERR("logger: failed to create writer thread (%i)", ret);
return;
}
_task_should_exit = false;
@@ -584,7 +589,7 @@ void Logger::run()
_writer.notify();
// wait for thread to complete
int ret = pthread_join(_writer_thread, NULL);
ret = pthread_join(_writer_thread, NULL);
if (ret) {
PX4_WARN("join failed: %d", ret);