18#ifndef _LOG4CXX_THREADUTILITY_H
19#define _LOG4CXX_THREADUTILITY_H
49typedef std::function<void(
LogString threadName,
50 std::thread::id threadId,
76 LOG4CXX_NS::helpers::ThreadStartPre preStartFunction();
77 LOG4CXX_NS::helpers::ThreadStarted threadStartedFunction();
78 LOG4CXX_NS::helpers::ThreadStartPost postStartFunction();
80 LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(priv_data, m_priv)
113 std::thread::id thread_id,
114 std::thread::native_handle_type native_handle);
126 template<
class Function,
class... Args>
131 LOG4CXX_NS::helpers::ThreadStartPre pre_start = preStartFunction();
132 LOG4CXX_NS::helpers::ThreadStarted thread_start = threadStartedFunction();
133 LOG4CXX_NS::helpers::ThreadStartPost post_start = postStartFunction();
140 std::thread t( f, args... );
Definition: threadutility.h:71
void configureFuncs(ThreadStartPre pre_start, ThreadStarted started, ThreadStartPost post_start)
Configure the thread functions that log4cxx will use.
void preThreadBlockSignals()
A pre-start thread function that blocks signals to the new thread (if the system has pthreads).
void threadStartedNameThread(LogString threadName, std::thread::id thread_id, std::thread::native_handle_type native_handle)
A thread_started function that names the thread using the appropriate system call.
static ThreadUtility * instance()
std::thread createThread(LogString name, Function &&f, Args &&... args)
Start a thread.
Definition: threadutility.h:127
void postThreadUnblockSignals()
A post-start thread function that unblocks signals that preThreadBlockSignals blocked before starting...
static void configure(ThreadConfigurationType type)
Utility method for configuring the ThreadUtility in a standard configuration.
std::function< void()> ThreadStartPost
Called after a thread has started.
Definition: threadutility.h:57
ThreadConfigurationType
Definition: threadutility.h:60
@ BlockSignalsAndNameThread
std::function< void(LogString threadName, std::thread::id threadId, std::thread::native_handle_type nativeHandle)> ThreadStarted
Called when a new thread has started.
Definition: threadutility.h:51
std::function< void()> ThreadStartPre
A function that will be called before a thread is started.
Definition: threadutility.h:38
std::basic_string< logchar > LogString
Definition: logstring.h:60
LOG4CXX_PTR_DEF(Appender)