libhomegear-base  0.7
Base library for Homegear and Homegear family modules.
BaseLib::ThreadManager Class Reference

#include <ThreadManager.h>

Public Member Functions

 ThreadManager ()
 
virtual ~ThreadManager ()
 
void init (BaseLib::SharedObjects *baseLib, bool testMaxThreadCount)
 
void setThreadPriority (pthread_t thread, int32_t priority, int32_t policy=SCHED_FIFO)
 
template<typename Function , typename... Args>
bool start (std::thread &thread, bool highPriority, Function &&function, Args &&... args)
 
template<typename Function , typename... Args>
bool start (std::thread &thread, bool highPriority, int32_t priority, int32_t policy, Function &&function, Args &&... args)
 
void join (std::thread &thread)
 
void registerThread ()
 
void unregisterThread ()
 
void setMaxThreadCount (uint32_t value)
 
uint32_t getMaxThreadCount ()
 
int32_t getCurrentThreadCount ()
 
uint32_t getMaxRegisteredThreadCount ()
 
void testMaxThreadCount ()
 

Static Public Member Functions

static int32_t getThreadPolicyFromString (std::string policy)
 
static int32_t parseThreadPriority (int32_t priority, int32_t policy)
 

Protected Member Functions

bool checkThreadCount (bool highPriority)
 

Protected Attributes

SharedObjects_bl = nullptr
 
std::mutex _threadCountMutex
 
uint32_t _maxRegisteredThreadCount = 0
 
uint32_t _maxThreadCount = 0
 
volatile int32_t _currentThreadCount = 0
 

Constructor & Destructor Documentation

§ ThreadManager()

BaseLib::ThreadManager::ThreadManager ( )

§ ~ThreadManager()

BaseLib::ThreadManager::~ThreadManager ( )
virtual

Member Function Documentation

§ checkThreadCount()

bool BaseLib::ThreadManager::checkThreadCount ( bool  highPriority)
protected

§ getCurrentThreadCount()

int32_t BaseLib::ThreadManager::getCurrentThreadCount ( )

§ getMaxRegisteredThreadCount()

uint32_t BaseLib::ThreadManager::getMaxRegisteredThreadCount ( )

§ getMaxThreadCount()

uint32_t BaseLib::ThreadManager::getMaxThreadCount ( )

§ getThreadPolicyFromString()

int32_t BaseLib::ThreadManager::getThreadPolicyFromString ( std::string  policy)
static

§ init()

void BaseLib::ThreadManager::init ( BaseLib::SharedObjects baseLib,
bool  testMaxThreadCount 
)

§ join()

void BaseLib::ThreadManager::join ( std::thread &  thread)

§ parseThreadPriority()

int32_t BaseLib::ThreadManager::parseThreadPriority ( int32_t  priority,
int32_t  policy 
)
static

§ registerThread()

void BaseLib::ThreadManager::registerThread ( )

§ setMaxThreadCount()

void BaseLib::ThreadManager::setMaxThreadCount ( uint32_t  value)

§ setThreadPriority()

void BaseLib::ThreadManager::setThreadPriority ( pthread_t  thread,
int32_t  priority,
int32_t  policy = SCHED_FIFO 
)

§ start() [1/2]

template<typename Function , typename... Args>
bool BaseLib::ThreadManager::start ( std::thread &  thread,
bool  highPriority,
Function &&  function,
Args &&...  args 
)
inline

§ start() [2/2]

template<typename Function , typename... Args>
bool BaseLib::ThreadManager::start ( std::thread &  thread,
bool  highPriority,
int32_t  priority,
int32_t  policy,
Function &&  function,
Args &&...  args 
)
inline

§ testMaxThreadCount()

void BaseLib::ThreadManager::testMaxThreadCount ( )

§ unregisterThread()

void BaseLib::ThreadManager::unregisterThread ( )

Member Data Documentation

§ _bl

SharedObjects* BaseLib::ThreadManager::_bl = nullptr
protected

§ _currentThreadCount

volatile int32_t BaseLib::ThreadManager::_currentThreadCount = 0
protected

§ _maxRegisteredThreadCount

uint32_t BaseLib::ThreadManager::_maxRegisteredThreadCount = 0
protected

§ _maxThreadCount

uint32_t BaseLib::ThreadManager::_maxThreadCount = 0
protected

§ _threadCountMutex

std::mutex BaseLib::ThreadManager::_threadCountMutex
protected

The documentation for this class was generated from the following files: