mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-25 00:31:36 +08:00
refactor logger: use static fields & move them to source file
avoids multiple declarations of...
This commit is contained in:
@@ -75,6 +75,10 @@
|
||||
|
||||
using namespace px4::logger;
|
||||
|
||||
static Logger *logger_ptr = nullptr;
|
||||
static int logger_task = -1;
|
||||
static pthread_t writer_thread;
|
||||
|
||||
int logger_main(int argc, char *argv[])
|
||||
{
|
||||
// logger currently assumes little endian
|
||||
@@ -464,7 +468,7 @@ void Logger::run()
|
||||
return;
|
||||
}
|
||||
|
||||
int ret = _writer.thread_start(_writer_thread);
|
||||
int ret = _writer.thread_start(writer_thread);
|
||||
|
||||
if (ret) {
|
||||
PX4_ERR("logger: failed to create writer thread (%i)", ret);
|
||||
@@ -616,7 +620,7 @@ void Logger::run()
|
||||
_writer.notify();
|
||||
|
||||
// wait for thread to complete
|
||||
ret = pthread_join(_writer_thread, NULL);
|
||||
ret = pthread_join(writer_thread, NULL);
|
||||
|
||||
if (ret) {
|
||||
PX4_WARN("join failed: %d", ret);
|
||||
|
||||
@@ -203,11 +203,8 @@ private:
|
||||
param_t _log_utc_offset;
|
||||
orb_advert_t _mavlink_log_pub = nullptr;
|
||||
uint16_t _next_topic_id; ///< id of next subscribed topic
|
||||
|
||||
};
|
||||
|
||||
Logger *logger_ptr = nullptr;
|
||||
int logger_task = -1;
|
||||
pthread_t _writer_thread;
|
||||
|
||||
}
|
||||
}
|
||||
} //namespace logger
|
||||
} //namespace px4
|
||||
|
||||
Reference in New Issue
Block a user