From c623d55010e64f3e5a965b6de918f4517de59d26 Mon Sep 17 00:00:00 2001 From: Mattias Flodin Date: Sun, 22 May 2016 22:39:19 +0200 Subject: [PATCH] Allow public access to the internal worker-thread object --- doc/manual.md | 9 +++++++++ reckless/include/reckless/basic_log.hpp | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/doc/manual.md b/doc/manual.md index a4d324d..0c2e8a7 100644 --- a/doc/manual.md +++ b/doc/manual.md @@ -64,6 +64,8 @@ public: void panic_flush(); + std::thread& worker_thread(); + protected: template void write(Args&&... args); @@ -125,6 +127,13 @@ after the call. The log object is left in a "panic" state that prevents any cleanup in the destructor. Any thread that tries to write to the log after this will be suspended. +worker_thread +Provide access to the internal worker-thread object. The intent is to allow +platform-specific manipulation of the thread, such as setting priority or +affinity. Use good judgement when accessing this object, as any destructive +action such as moving or detaching it can cause reckless to +malfunction. + write Store args on the asynchronous queue and invoke the static function Formatter::format(output_buffer*, Args...) from the diff --git a/reckless/include/reckless/basic_log.hpp b/reckless/include/reckless/basic_log.hpp index 428d710..4952ae2 100644 --- a/reckless/include/reckless/basic_log.hpp +++ b/reckless/include/reckless/basic_log.hpp @@ -100,6 +100,14 @@ class basic_log : private output_buffer { void panic_flush(); + // Provide access to the internal worker-thread object. The intent is to + // allow platform-specific manipulation of the thread, such as setting + // priority or affinity. + std::thread& worker_thread() + { + return output_thread_; + } + protected: template void write(Args&&... args)