mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-23 14:57:35 +08:00
logger: move thread start/stop logic into LogWriterFile
This commit is contained in:
@@ -635,16 +635,7 @@ void Logger::run()
|
||||
|
||||
|
||||
if (!_writer.init()) {
|
||||
PX4_ERR("init of writer failed (alloc failed)");
|
||||
return;
|
||||
}
|
||||
|
||||
pthread_t writer_thread;
|
||||
|
||||
int ret = _writer.thread_start(writer_thread);
|
||||
|
||||
if (ret) {
|
||||
PX4_ERR("failed to create writer thread (%i)", ret);
|
||||
PX4_ERR("writer init failed");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -814,15 +805,6 @@ void Logger::run()
|
||||
// stop the writer thread
|
||||
_writer.thread_stop();
|
||||
|
||||
_writer.notify();
|
||||
|
||||
// wait for thread to complete
|
||||
ret = pthread_join(writer_thread, NULL);
|
||||
|
||||
if (ret) {
|
||||
PX4_WARN("join failed: %d", ret);
|
||||
}
|
||||
|
||||
//unsubscribe
|
||||
for (LoggerSubscription &sub : _subscriptions) {
|
||||
for (uint8_t instance = 0; instance < ORB_MULTI_MAX_INSTANCES; instance++) {
|
||||
|
||||
Reference in New Issue
Block a user