diff options
Diffstat (limited to 'src/corelib/thread/qthreadpool.cpp')
-rw-r--r-- | src/corelib/thread/qthreadpool.cpp | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp index ccd8194b35..8eca3b56e4 100644 --- a/src/corelib/thread/qthreadpool.cpp +++ b/src/corelib/thread/qthreadpool.cpp @@ -74,7 +74,9 @@ public: */ QThreadPoolThread::QThreadPoolThread(QThreadPoolPrivate *manager) :manager(manager), runnable(nullptr) -{ } +{ + setStackSize(manager->stackSize); +} /* \internal @@ -165,11 +167,6 @@ void QThreadPoolThread::registerThreadInactive() \internal */ QThreadPoolPrivate:: QThreadPoolPrivate() - : isExiting(false), - expiryTimeout(30000), - maxThreadCount(qAbs(QThread::idealThreadCount())), - reservedThreads(0), - activeThreads(0) { } bool QThreadPoolPrivate::tryStart(QRunnable *task) @@ -636,6 +633,32 @@ void QThreadPool::reserveThread() ++d->reservedThreads; } +/*! \property QThreadPool::stackSize + + This property contains the stack size for the thread pool worker + threads. + + The value of the property is only used when the thread pool creates + new threads. Changing it has no effect for already created + or running threads. + + The default value is 0, which makes QThread use the operating + system default stack size. + + \since 5.10 +*/ +void QThreadPool::setStackSize(uint stackSize) +{ + Q_D(QThreadPool); + d->stackSize = stackSize; +} + +uint QThreadPool::stackSize() const +{ + Q_D(const QThreadPool); + return d->stackSize; +} + /*! Releases a thread previously reserved by a call to reserveThread(). |