diff options
| author | Morten Johan Sørvig <morten.sorvig@qt.io> | 2017-06-21 11:48:09 +0200 |
|---|---|---|
| committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2017-08-02 21:58:54 +0000 |
| commit | e44ff1978344600cd9b1f41949697f0e877fd5cd (patch) | |
| tree | 3fffc14497eacd8d8e3ad27b7c7f1872f674cd23 /src/corelib/thread/qthreadpool.cpp | |
| parent | 5c9c55906c858c1a8147e9e3fd074784bb68d645 (diff) | |
Add QThreadPool::stackSize
Allows setting the stack size for the thread pool
worker threads. Implemented using QThread::stackSize.
Task-number: QTBUG-2568
Change-Id: Ic7f3981289290685195bbaee977a23e0c3c49bf0
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/corelib/thread/qthreadpool.cpp')
| -rw-r--r-- | src/corelib/thread/qthreadpool.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp index 71310b0ebf0..99372016195 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(0) -{ } +{ + setStackSize(manager->stackSize); +} /* \internal @@ -604,6 +606,30 @@ 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 uses when the thread pool creates + new threads only. 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 stize. +*/ +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(). |
