2
* Copyright (C) 2010, 2011 Tuomo Penttinen, all rights reserved.
4
* Author: Tuomo Penttinen <tp@herqq.org>
6
* This file is part of Herqq UPnP (HUPnP) library.
8
* Herqq UPnP is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU Lesser General Public License as published by
10
* the Free Software Foundation, either version 3 of the License, or
11
* (at your option) any later version.
13
* Herqq UPnP is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU Lesser General Public License for more details.
18
* You should have received a copy of the GNU Lesser General Public License
19
* along with Herqq UPnP. If not, see <http://www.gnu.org/licenses/>.
22
#ifndef HTHREADPOOL_P_H_
23
#define HTHREADPOOL_P_H_
28
// This file is not part of public API and it should
29
// never be included in client code. The contents of this file may
30
// change or the file may be removed without of notice.
33
#include "../general/hupnp_defs.h"
35
#include <QtCore/QList>
36
#include <QtCore/QMutex>
37
#include <QtCore/QObject>
38
#include <QtCore/QAtomicInt>
39
#include <QtCore/QThreadPool>
40
#include <QtCore/QWaitCondition>
57
H_DISABLE_COPY(HRunnable)
58
friend class HThreadPool;
74
QWaitCondition m_statusWait;
82
virtual ~HRunnable() = 0;
84
void signalTaskComplete();
99
H_DISABLE_COPY(HThreadPool)
100
friend class HRunnable;
104
QThreadPool* m_threadPool;
105
QList<HRunnable*> m_runnables;
106
QMutex m_runnablesMutex;
108
void exiting(HRunnable*);
112
HThreadPool(QObject* parent);
113
virtual ~HThreadPool();
115
void start(HRunnable*);
118
inline void setMaxThreadCount(qint32 count)
120
m_threadPool->setMaxThreadCount(count);
123
inline int activeThreadCount() const
125
return m_threadPool->activeThreadCount();
132
#endif /* HTHREADPOOL_P_H_ */