mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-26 07:29:03 +08:00
fix deadlock on filename() call
This commit is contained in:
parent
3dedb52163
commit
0b86d6a451
@ -70,12 +70,6 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
filename_t filename()
|
|
||||||
{
|
|
||||||
std::lock_guard<Mutex> lock(base_sink<Mutex>::mutex_);
|
|
||||||
return file_helper_.filename();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void sink_it_(const details::log_msg &msg) override
|
void sink_it_(const details::log_msg &msg) override
|
||||||
{
|
{
|
||||||
@ -155,7 +149,7 @@ private:
|
|||||||
using details::os::filename_to_str;
|
using details::os::filename_to_str;
|
||||||
using details::os::remove_if_exists;
|
using details::os::remove_if_exists;
|
||||||
|
|
||||||
filename_t current_file = filename();
|
filename_t current_file = file_helper_.filename();
|
||||||
if (filenames_q_.full())
|
if (filenames_q_.full())
|
||||||
{
|
{
|
||||||
auto old_filename = std::move(filenames_q_.front());
|
auto old_filename = std::move(filenames_q_.front());
|
||||||
|
@ -53,13 +53,6 @@ SPDLOG_INLINE filename_t rotating_file_sink<Mutex>::calc_filename(const filename
|
|||||||
return fmt::format(SPDLOG_FILENAME_T("{}.{}{}"), basename, index, ext);
|
return fmt::format(SPDLOG_FILENAME_T("{}.{}{}"), basename, index, ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Mutex>
|
|
||||||
SPDLOG_INLINE filename_t rotating_file_sink<Mutex>::filename()
|
|
||||||
{
|
|
||||||
std::lock_guard<Mutex> lock(base_sink<Mutex>::mutex_);
|
|
||||||
return file_helper_.filename();
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename Mutex>
|
template<typename Mutex>
|
||||||
SPDLOG_INLINE void rotating_file_sink<Mutex>::sink_it_(const details::log_msg &msg)
|
SPDLOG_INLINE void rotating_file_sink<Mutex>::sink_it_(const details::log_msg &msg)
|
||||||
{
|
{
|
||||||
|
@ -24,7 +24,6 @@ class rotating_file_sink final : public base_sink<Mutex>
|
|||||||
public:
|
public:
|
||||||
rotating_file_sink(filename_t base_filename, std::size_t max_size, std::size_t max_files, bool rotate_on_open = false);
|
rotating_file_sink(filename_t base_filename, std::size_t max_size, std::size_t max_files, bool rotate_on_open = false);
|
||||||
static filename_t calc_filename(const filename_t &filename, std::size_t index);
|
static filename_t calc_filename(const filename_t &filename, std::size_t index);
|
||||||
filename_t filename();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void sink_it_(const details::log_msg &msg) override;
|
void sink_it_(const details::log_msg &msg) override;
|
||||||
|
Loading…
Reference in New Issue
Block a user