MythTV master
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
MThreadPool Class Reference

#include <libmythbase/mthreadpool.h>

Collaboration diagram for MThreadPool:
[legend]

Public Member Functions

 MThreadPool (const QString &name)
 
 ~MThreadPool ()
 
 MThreadPool (const MThreadPool &)=delete
 
MThreadPooloperator= (const MThreadPool &)=delete
 
void Stop (void)
 
void DeletePoolThreads (void)
 
void start (QRunnable *runnable, const QString &debugName, int priority=0)
 
bool tryStart (QRunnable *runnable, const QString &debugName)
 
void startReserved (QRunnable *runnable, const QString &debugName, std::chrono::milliseconds waitForAvailMS=0ms)
 
std::chrono::milliseconds expiryTimeout (void) const
 
void setExpiryTimeout (std::chrono::milliseconds expiryTimeout)
 
int maxThreadCount (void) const
 
void setMaxThreadCount (int maxThreadCount)
 
int activeThreadCount (void) const
 
void waitForDone (void)
 

Static Public Member Functions

static MThreadPoolglobalInstance (void)
 
static void StopAllPools (void)
 
static void ShutdownAllPools (void)
 

Private Member Functions

bool TryStartInternal (QRunnable *runnable, const QString &debugName, bool reserved)
 
void NotifyAvailable (MPoolThread *thread)
 
void NotifyDone (MPoolThread *thread)
 
void ReleaseThread (void)
 

Private Attributes

MThreadPoolPrivatem_priv {nullptr}
 

Friends

class MPoolThread
 

Detailed Description

Definition at line 18 of file mthreadpool.h.

Constructor & Destructor Documentation

◆ MThreadPool() [1/2]

MThreadPool::MThreadPool ( const QString &  name)
explicit

Definition at line 237 of file mthreadpool.cpp.

Referenced by globalInstance().

◆ ~MThreadPool()

MThreadPool::~MThreadPool ( )

Definition at line 244 of file mthreadpool.cpp.

◆ MThreadPool() [2/2]

MThreadPool::MThreadPool ( const MThreadPool )
delete

Member Function Documentation

◆ activeThreadCount()

int MThreadPool::activeThreadCount ( void  ) const

Definition at line 515 of file mthreadpool.cpp.

◆ DeletePoolThreads()

void MThreadPool::DeletePoolThreads ( void  )

Definition at line 269 of file mthreadpool.cpp.

Referenced by ~MThreadPool().

◆ expiryTimeout()

std::chrono::milliseconds MThreadPool::expiryTimeout ( void  ) const

Definition at line 491 of file mthreadpool.cpp.

Referenced by setExpiryTimeout().

◆ globalInstance()

MThreadPool * MThreadPool::globalInstance ( void  )
static

◆ maxThreadCount()

int MThreadPool::maxThreadCount ( void  ) const

◆ NotifyAvailable()

void MThreadPool::NotifyAvailable ( MPoolThread thread)
private

Definition at line 439 of file mthreadpool.cpp.

Referenced by MPoolThread::run().

◆ NotifyDone()

void MThreadPool::NotifyDone ( MPoolThread thread)
private

Definition at line 481 of file mthreadpool.cpp.

Referenced by MPoolThread::run().

◆ operator=()

MThreadPool & MThreadPool::operator= ( const MThreadPool )
delete

◆ ReleaseThread()

void MThreadPool::ReleaseThread ( void  )
private

Definition at line 536 of file mthreadpool.cpp.

Referenced by MPoolThread::run().

◆ setExpiryTimeout()

void MThreadPool::setExpiryTimeout ( std::chrono::milliseconds  expiryTimeout)

Definition at line 497 of file mthreadpool.cpp.

◆ setMaxThreadCount()

void MThreadPool::setMaxThreadCount ( int  maxThreadCount)

◆ ShutdownAllPools()

void MThreadPool::ShutdownAllPools ( void  )
static

Definition at line 315 of file mthreadpool.cpp.

Referenced by MythCoreContextPrivate::~MythCoreContextPrivate().

◆ start()

void MThreadPool::start ( QRunnable *  runnable,
const QString &  debugName,
int  priority = 0 
)

◆ startReserved()

void MThreadPool::startReserved ( QRunnable *  runnable,
const QString &  debugName,
std::chrono::milliseconds  waitForAvailMS = 0ms 
)

◆ Stop()

void MThreadPool::Stop ( void  )

◆ StopAllPools()

void MThreadPool::StopAllPools ( void  )
static

Definition at line 304 of file mthreadpool.cpp.

Referenced by MythCoreContextPrivate::~MythCoreContextPrivate().

◆ tryStart()

bool MThreadPool::tryStart ( QRunnable *  runnable,
const QString &  debugName 
)

Definition at line 372 of file mthreadpool.cpp.

◆ TryStartInternal()

bool MThreadPool::TryStartInternal ( QRunnable *  runnable,
const QString &  debugName,
bool  reserved 
)
private

Definition at line 378 of file mthreadpool.cpp.

Referenced by NotifyAvailable(), start(), startReserved(), and tryStart().

◆ waitForDone()

void MThreadPool::waitForDone ( void  )

Friends And Related Function Documentation

◆ MPoolThread

friend class MPoolThread
friend

Definition at line 20 of file mthreadpool.h.

Referenced by TryStartInternal().

Member Data Documentation

◆ m_priv

MThreadPoolPrivate* MThreadPool::m_priv {nullptr}
private

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