diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2021-04-21 17:51:01 -0700 |
---|---|---|
committer | Samuel Gaist <samuel.gaist@idiap.ch> | 2021-04-24 00:37:14 +0000 |
commit | 885eff053797d56f2e295558d0a71b030fbb1a69 (patch) | |
tree | e296ae224ddb00ff3259f8efafda306587865034 /tests/auto | |
parent | ddaa7150d85624ab545ccfe098fe8b2d18241940 (diff) |
QThreadPool: obey the docs that say we always use at least 1 thread
Even if the user (usually accidentally) sets a thread count of zero or
negative. The reporter in the bug report did
QThread::idealThreadCount() - 1 on a 1 CPU system...
Drive-by add to the documentation and the missing #include.
Pick-to: 6.1 6.0
Fixes: QTBUG-93007
Change-Id: I6cdea00671e8479b9c50fffd167807d14e030154
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp index 0fb4bfbe56..bb8513fe1d 100644 --- a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp +++ b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp @@ -506,7 +506,7 @@ void tst_QThreadPool::setMaxThreadCountStartsAndStopsThreads() }; QThreadPool threadPool; - threadPool.setMaxThreadCount(1); + threadPool.setMaxThreadCount(-1); // docs say we'll always start at least one WaitingTask task; threadPool.start(&task); |