|
Apache Log4cxx
Version 1.7.0
|
#include <threadutility.h>
Public Types | |
| using | Period = std::chrono::milliseconds |
| using | Manager = SingletonHolder<ThreadUtility> |
Public Member Functions | |
| ~ThreadUtility () | |
| 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. | |
| void | postThreadUnblockSignals () |
| A post-start thread function that unblocks signals that preThreadBlockSignals blocked before starting the thread. | |
| template<class Function, class... Args> | |
| std::thread | createThread (LogString name, Function &&f, Args &&... args) |
| Start a thread. | |
| void | addPeriodicTask (const LogString &taskName, std::function< void()> f, const Period &delay) |
Add the taskName periodic task. | |
| bool | hasPeriodicTask (const LogString &taskName) |
Has a taskName periodic task already been added? | |
| void | removeAllPeriodicTasks () |
| Remove all periodic tasks and stop the processing thread. | |
| void | removePeriodicTask (const LogString &taskName) |
Remove the taskName periodic task. | |
| void | removePeriodicTasksMatching (const LogString &namePrefix) |
Remove any periodic task matching namePrefix. | |
| LOG4CXX_PTR_DEF (Manager) | |
Static Public Member Functions | |
| static ThreadUtility * | instance () |
| static void | configure (ThreadConfigurationType type) |
| Utility method for configuring the ThreadUtility in a standard configuration. | |
| static ManagerPtr | instancePtr () |
Friends | |
| class | SingletonHolder< ThreadUtility > |
| using log4cxx::helpers::ThreadUtility::Manager = SingletonHolder<ThreadUtility> |
| using log4cxx::helpers::ThreadUtility::Period = std::chrono::milliseconds |
| log4cxx::helpers::ThreadUtility::~ThreadUtility | ( | ) |
| void log4cxx::helpers::ThreadUtility::addPeriodicTask | ( | const LogString & | taskName, |
| std::function< void()> | f, | ||
| const Period & | delay ) |
Add the taskName periodic task.
|
static |
Utility method for configuring the ThreadUtility in a standard configuration.
| void log4cxx::helpers::ThreadUtility::configureFuncs | ( | ThreadStartPre | pre_start, |
| ThreadStarted | started, | ||
| ThreadStartPost | post_start ) |
Configure the thread functions that log4cxx will use.
Note that setting any of these parameters to nullptr is valid, and simply results in the callback not being called.
|
inline |
Start a thread.
| bool log4cxx::helpers::ThreadUtility::hasPeriodicTask | ( | const LogString & | taskName | ) |
Has a taskName periodic task already been added?
|
static |
|
static |
| log4cxx::helpers::ThreadUtility::LOG4CXX_PTR_DEF | ( | Manager | ) |
| void log4cxx::helpers::ThreadUtility::postThreadUnblockSignals | ( | ) |
A post-start thread function that unblocks signals that preThreadBlockSignals blocked before starting the thread.
If the system does not have pthreads, does nothing.
| void log4cxx::helpers::ThreadUtility::preThreadBlockSignals | ( | ) |
A pre-start thread function that blocks signals to the new thread (if the system has pthreads).
If the system does not have pthreads, does nothing.
| void log4cxx::helpers::ThreadUtility::removeAllPeriodicTasks | ( | ) |
Remove all periodic tasks and stop the processing thread.
| void log4cxx::helpers::ThreadUtility::removePeriodicTask | ( | const LogString & | taskName | ) |
Remove the taskName periodic task.
| void log4cxx::helpers::ThreadUtility::removePeriodicTasksMatching | ( | const LogString & | namePrefix | ) |
Remove any periodic task matching namePrefix.
| void log4cxx::helpers::ThreadUtility::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.
|
friend |