Code review fix - periodic_worker thread getter should return a reference and not a pointer

pull/3009/head
Dan Cohen 2 years ago
parent 0e5cd15f1c
commit 0936f2bee4

@ -38,7 +38,7 @@ public:
}
});
}
std::thread *get_thread() { return &worker_thread_; }
std::thread &get_thread() { return worker_thread_; }
periodic_worker(const periodic_worker &) = delete;
periodic_worker &operator=(const periodic_worker &) = delete;
// stop the worker thread and join it

@ -68,7 +68,7 @@ public:
periodic_flusher_ = details::make_unique<periodic_worker>(clbk, interval);
}
std::unique_ptr<periodic_worker> &get_flusher() { return periodic_flusher_; }
std::unique_ptr<periodic_worker> &get_flusher() { std::lock_guard<std::mutex> lock(flusher_mutex_); return periodic_flusher_; }
void set_error_handler(err_handler handler);

@ -89,9 +89,4 @@ SPDLOG_INLINE void apply_logger_env_levels(std::shared_ptr<logger> logger) {
details::registry::instance().apply_logger_env_levels(std::move(logger));
}
SPDLOG_INLINE std::unique_ptr<spdlog::details::periodic_worker> &get_flusher()
{
return details::registry::instance().get_flusher();
}
} // namespace spdlog

Loading…
Cancel
Save