9#define LOC QString("HTTPPool: ")
14 m_maxThreads =
static_cast<size_t>(std::max(QThread::idealThreadCount() * 2, 4));
19 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"Using maximum %1 threads").arg(
m_maxThreads));
35 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Threadpool error: upgraded count is higher than total");
57 auto * qthread =
dynamic_cast<QThread*
>(sender());
58 auto found = std::ranges::find_if(std::as_const(
m_threads),
62 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Unknown HTTP thread finished");
72 LOG(VB_HTTP, LOG_INFO,
LOC + QString(
"Deleting thread '%1'").arg((*found)->objectName()));
79 auto found = std::ranges::find_if(std::as_const(
m_threads),
83 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"Unknown thread '%1' upgraded").arg(Thread->objectName()));
90 LOG(VB_HTTP, LOG_INFO,
LOC + QString(
"Thread '%1' upgraded (Standard:%2 Upgraded:%3)")
91 .arg(Thread->objectName()).arg(standard).arg(upgraded));
99 LOG(VB_GENERAL, LOG_WARNING,
LOC + QString(
"%1 upgraded sockets - notional max is %2")
QThread * qthread(void)
Returns the thread, this will always return the same pointer no matter how often you restart the thre...
~MythHTTPThreadPool() override
void ThreadUpgraded(QThread *Thread)
std::list< MythHTTPThread * > m_upgradedThreads
size_t MaxThreads() const
size_t ThreadCount() const
size_t AvailableThreads() const
std::list< MythHTTPThread * > m_threads
void AddThread(MythHTTPThread *Thread)
void setMaxPendingConnections(int n)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)