Use atexit to cleanup bus connections before exiting.

This commit is contained in:
Vibhav Pant
2023-09-03 13:10:18 +05:30
parent 5e18c84b98
commit e8236aad62
2 changed files with 11 additions and 0 deletions
@@ -33,9 +33,14 @@ namespace nearby {
static std::unique_ptr<linux::LogControl> global_log_control_;
static absl::once_flag log_control_init_;
static void cleanup_log_control() {
global_log_control_ = nullptr;
}
static void init_log_control(std::nullptr_t) {
global_log_control_ =
std::make_unique<linux::LogControl>(linux::getDefaultBusConnection());
atexit(cleanup_log_control);
}
namespace api {