diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-04-17 15:04:23 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-04-17 15:04:23 (GMT) |
commit | c29533ab2094c38bb63d50dd6306cfe6ccacc868 (patch) | |
tree | e539b2062c870dd431f522d1d1e0677008eaa717 /src/corelib/concurrent/qtconcurrentreducekernel.h | |
parent | f15b8a83e2e51955776a3f07cb85ebfc342dd8ef (diff) | |
parent | 198efeb27e5c2a87d0a2bb6859446cb1faf45ed8 (diff) | |
download | Qt-c29533ab2094c38bb63d50dd6306cfe6ccacc868.zip Qt-c29533ab2094c38bb63d50dd6306cfe6ccacc868.tar.gz Qt-c29533ab2094c38bb63d50dd6306cfe6ccacc868.tar.bz2 |
Merge branch 'kinetic-animations' into kinetic-statemachine
Diffstat (limited to 'src/corelib/concurrent/qtconcurrentreducekernel.h')
-rw-r--r-- | src/corelib/concurrent/qtconcurrentreducekernel.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/corelib/concurrent/qtconcurrentreducekernel.h b/src/corelib/concurrent/qtconcurrentreducekernel.h index e863b63..2dad519 100644 --- a/src/corelib/concurrent/qtconcurrentreducekernel.h +++ b/src/corelib/concurrent/qtconcurrentreducekernel.h @@ -51,6 +51,7 @@ #include <QtCore/qmap.h> #include <QtCore/qmutex.h> #include <QtCore/qthread.h> +#include <QtCore/qthreadpool.h> #include <QtCore/qvector.h> QT_BEGIN_HEADER @@ -107,7 +108,7 @@ class ReduceKernel const ReduceOptions reduceOptions; QMutex mutex; - int progress, resultsMapSize; + int progress, resultsMapSize, threadCount; ResultsMap resultsMap; bool canReduce(int begin) const @@ -140,7 +141,8 @@ class ReduceKernel public: ReduceKernel(ReduceOptions _reduceOptions) - : reduceOptions(_reduceOptions), progress(0), resultsMapSize(0) + : reduceOptions(_reduceOptions), progress(0), resultsMapSize(0), + threadCount(QThreadPool::globalInstance()->maxThreadCount()) { } void runReduce(ReduceFunctor &reduce, @@ -210,12 +212,12 @@ public: inline bool shouldThrottle() { - return (resultsMapSize > (ReduceQueueThrottleLimit * QThread::idealThreadCount())); + return (resultsMapSize > (ReduceQueueThrottleLimit * threadCount)); } inline bool shouldStartThread() { - return (resultsMapSize <= (ReduceQueueStartLimit * QThread::idealThreadCount())); + return (resultsMapSize <= (ReduceQueueStartLimit * threadCount)); } }; |