mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-15 16:35:45 +08:00
Expose the flusher thread object to user in order to allow setting of thread name and thread affinity when needed (#3009)
* Expose the flusher thread object to user in order to allow setting of thread name and thread affinity when needed * Code review fix - periodic_worker thread getter should return a reference and not a pointer
This commit is contained in:
parent
c577b54b06
commit
dd8dc8105a
@ -40,6 +40,7 @@ public:
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
std::thread &get_thread() { return worker_thread_; }
|
||||||
periodic_worker(const periodic_worker &) = delete;
|
periodic_worker(const periodic_worker &) = delete;
|
||||||
periodic_worker &operator=(const periodic_worker &) = delete;
|
periodic_worker &operator=(const periodic_worker &) = delete;
|
||||||
// stop the worker thread and join it
|
// stop the worker thread and join it
|
||||||
|
@ -66,6 +66,8 @@ public:
|
|||||||
periodic_flusher_ = std::make_unique<periodic_worker>(clbk, interval);
|
periodic_flusher_ = std::make_unique<periodic_worker>(clbk, interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
void set_error_handler(err_handler handler);
|
||||||
|
|
||||||
void apply_all(const std::function<void(const std::shared_ptr<logger>)> &fun);
|
void apply_all(const std::function<void(const std::shared_ptr<logger>)> &fun);
|
||||||
|
Loading…
Reference in New Issue
Block a user