<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qthreadpool.cpp --> <title>QThreadPool Class | Qt Core 5.12.2</title> <link rel="stylesheet" type="text/css" href="style/offline-simple.css" /> <script type="text/javascript"> document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css"); // loading style sheet breaks anchors that were jumped to before // so force jumping to anchor again setTimeout(function() { var anchor = location.hash; // need to jump to different anchor first (e.g. none) location.hash = "#"; setTimeout(function() { location.hash = anchor; }, 0); }, 0); </script> </head> <body> <div class="header" id="qtdocheader"> <div class="main"> <div class="main-rounded"> <div class="navigationbar"> <table><tr> <td >Qt 5.12</td><td ><a href="qtcore-index.html">Qt Core</a></td><td ><a href="qtcore-module.html">C++ Classes</a></td><td >QThreadPool</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right"><a href="qtcore-index.html">Qt 5.12.2 Reference Documentation</a></td> </tr></table> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <div class="sidebar"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#properties">Properties</a></li> <li class="level1"><a href="#public-functions">Public Functions</a></li> <li class="level1"><a href="#static-public-members">Static Public Members</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QThreadPool Class</h1> <!-- $$$QThreadPool-brief --> <p>The <a href="qthreadpool.html">QThreadPool</a> class manages a collection of QThreads. <a href="#details">More...</a></p> <!-- @@@QThreadPool --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QThreadPool></span> </td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += core</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> Qt 4.4</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="qobject.html">QObject</a></td></tr></table></div><ul> <li><a href="qthreadpool-members.html">List of all members, including inherited members</a></li> <li><a href="qthreadpool-obsolete.html">Obsolete members</a></li> </ul> <p><b>Note:</b> All functions in this class are thread-safe.</p> <a name="properties"></a> <h2 id="properties">Properties</h2> <ul> <li class="fn"><b><a href="qthreadpool.html#activeThreadCount-prop">activeThreadCount</a></b> : const int</li> <li class="fn"><b><a href="qthreadpool.html#expiryTimeout-prop">expiryTimeout</a></b> : int</li> <li class="fn"><b><a href="qthreadpool.html#maxThreadCount-prop">maxThreadCount</a></b> : int</li> <li class="fn"><b><a href="qthreadpool.html#stackSize-prop">stackSize</a></b> : uint</li> </ul> <ul> <li class="fn">1 property inherited from <a href="qobject.html#properties">QObject</a></li> </ul> <a name="public-functions"></a> <h2 id="public-functions">Public Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qthreadpool.html#QThreadPool">QThreadPool</a></b>(QObject *<i>parent</i> = nullptr)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qthreadpool.html#dtor.QThreadPool">~QThreadPool</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qthreadpool.html#activeThreadCount-prop">activeThreadCount</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qthreadpool.html#clear">clear</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qthreadpool.html#expiryTimeout-prop">expiryTimeout</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qthreadpool.html#maxThreadCount-prop">maxThreadCount</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qthreadpool.html#releaseThread">releaseThread</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qthreadpool.html#reserveThread">reserveThread</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qthreadpool.html#expiryTimeout-prop">setExpiryTimeout</a></b>(int <i>expiryTimeout</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qthreadpool.html#maxThreadCount-prop">setMaxThreadCount</a></b>(int <i>maxThreadCount</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qthreadpool.html#stackSize-prop">setStackSize</a></b>(uint <i>stackSize</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> uint </td><td class="memItemRight bottomAlign"><b><a href="qthreadpool.html#stackSize-prop">stackSize</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qthreadpool.html#start">start</a></b>(QRunnable *<i>runnable</i>, int <i>priority</i> = 0)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qthreadpool.html#tryStart">tryStart</a></b>(QRunnable *<i>runnable</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qthreadpool.html#tryTake">tryTake</a></b>(QRunnable *<i>runnable</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qthreadpool.html#waitForDone">waitForDone</a></b>(int <i>msecs</i> = -1)</td></tr> </table></div> <ul> <li class="fn">32 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li> </ul> <a name="static-public-members"></a> <h2 id="static-public-members">Static Public Members</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> QThreadPool *</td><td class="memItemRight bottomAlign"><b><a href="qthreadpool.html#globalInstance">globalInstance</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> const QMetaObject </td><td class="memItemRight bottomAlign"><b><a href="qthreadpool.html#staticMetaObject-var">staticMetaObject</a></b></td></tr> </table></div> <ul> <li class="fn">10 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li> </ul> <h3>Additional Inherited Members</h3> <ul> <li class="fn">1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li> <li class="fn">2 signals inherited from <a href="qobject.html#signals">QObject</a></li> <li class="fn">9 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li> </ul> <a name="details"></a> <!-- $$$QThreadPool-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qthreadpool.html">QThreadPool</a> class manages a collection of QThreads.</p> <p><a href="qthreadpool.html">QThreadPool</a> manages and recyles individual <a href="qthread.html">QThread</a> objects to help reduce thread creation costs in programs that use threads. Each Qt application has one global <a href="qthreadpool.html">QThreadPool</a> object, which can be accessed by calling <a href="qthreadpool.html#globalInstance">globalInstance</a>().</p> <p>To use one of the <a href="qthreadpool.html">QThreadPool</a> threads, subclass <a href="qrunnable.html">QRunnable</a> and implement the run() virtual function. Then create an object of that class and pass it to <a href="qthreadpool.html#start">QThreadPool::start</a>().</p> <pre class="cpp"> <span class="keyword">class</span> HelloWorldTask : <span class="keyword">public</span> <span class="type"><a href="qrunnable.html">QRunnable</a></span> { <span class="type">void</span> run() override { <a href="qtglobal.html#qDebug">qDebug</a>() <span class="operator"><</span><span class="operator"><</span> <span class="string">"Hello world from thread"</span> <span class="operator"><</span><span class="operator"><</span> <span class="type"><a href="qthread.html">QThread</a></span><span class="operator">::</span>currentThread(); } }; HelloWorldTask <span class="operator">*</span>hello <span class="operator">=</span> <span class="keyword">new</span> HelloWorldTask(); <span class="comment">// QThreadPool takes ownership and deletes 'hello' automatically</span> <span class="type"><a href="qthreadpool.html#QThreadPool">QThreadPool</a></span><span class="operator">::</span>globalInstance()<span class="operator">-</span><span class="operator">></span>start(hello); </pre> <p><a href="qthreadpool.html">QThreadPool</a> deletes the <a href="qrunnable.html">QRunnable</a> automatically by default. Use <a href="qrunnable.html#setAutoDelete">QRunnable::setAutoDelete</a>() to change the auto-deletion flag.</p> <p><a href="qthreadpool.html">QThreadPool</a> supports executing the same <a href="qrunnable.html">QRunnable</a> more than once by calling <a href="qthreadpool.html#tryStart">tryStart</a>(this) from within <a href="qrunnable.html#run">QRunnable::run</a>(). If autoDelete is enabled the <a href="qrunnable.html">QRunnable</a> will be deleted when the last thread exits the run function. Calling <a href="qthreadpool.html#start">start</a>() multiple times with the same <a href="qrunnable.html">QRunnable</a> when autoDelete is enabled creates a race condition and is not recommended.</p> <p>Threads that are unused for a certain amount of time will expire. The default expiry timeout is 30000 milliseconds (30 seconds). This can be changed using <a href="qthreadpool.html#expiryTimeout-prop">setExpiryTimeout</a>(). Setting a negative expiry timeout disables the expiry mechanism.</p> <p>Call <a href="qthreadpool.html#maxThreadCount-prop">maxThreadCount</a>() to query the maximum number of threads to be used. If needed, you can change the limit with <a href="qthreadpool.html#maxThreadCount-prop">setMaxThreadCount</a>(). The default <a href="qthreadpool.html#maxThreadCount-prop">maxThreadCount</a>() is <a href="qthread.html#idealThreadCount">QThread::idealThreadCount</a>(). The <a href="qthreadpool.html#activeThreadCount-prop">activeThreadCount</a>() function returns the number of threads currently doing work.</p> <p>The <a href="qthreadpool.html#reserveThread">reserveThread</a>() function reserves a thread for external use. Use <a href="qthreadpool.html#releaseThread">releaseThread</a>() when your are done with the thread, so that it may be reused. Essentially, these functions temporarily increase or reduce the active thread count and are useful when implementing time-consuming operations that are not visible to the <a href="qthreadpool.html">QThreadPool</a>.</p> <p>Note that <a href="qthreadpool.html">QThreadPool</a> is a low-level class for managing threads, see the Qt Concurrent module for higher level alternatives.</p> </div> <p><b>See also </b><a href="qrunnable.html">QRunnable</a>.</p> <!-- @@@QThreadPool --> <div class="prop"> <h2>Property Documentation</h2> <!-- $$$activeThreadCount-prop$$$activeThreadCount --> <h3 class="fn" id="activeThreadCount-prop"><a name="activeThreadCount-prop"></a><span class="name">activeThreadCount</span> : const <span class="type">int</span></h3> <p>This property represents the number of active threads in the thread pool.</p> <p><b>Note: </b>It is possible for this function to return a value that is greater than <a href="qthreadpool.html#maxThreadCount-prop">maxThreadCount</a>(). See <a href="qthreadpool.html#reserveThread">reserveThread</a>() for more details.</p><p><b>Access functions:</b></p> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>activeThreadCount</b></span>() const</td></tr> </table></div> <p><b>See also </b><a href="qthreadpool.html#reserveThread">reserveThread</a>() and <a href="qthreadpool.html#releaseThread">releaseThread</a>().</p> <!-- @@@activeThreadCount --> <!-- $$$expiryTimeout-prop$$$expiryTimeout$$$setExpiryTimeoutint --> <h3 class="fn" id="expiryTimeout-prop"><a name="expiryTimeout-prop"></a><span class="name">expiryTimeout</span> : <span class="type">int</span></h3> <p>Threads that are unused for <i>expiryTimeout</i> milliseconds are considered to have expired and will exit. Such threads will be restarted as needed. The default <i>expiryTimeout</i> is 30000 milliseconds (30 seconds). If <i>expiryTimeout</i> is negative, newly created threads will not expire, e.g., they will not exit until the thread pool is destroyed.</p> <p>Note that setting <i>expiryTimeout</i> has no effect on already running threads. Only newly created threads will use the new <i>expiryTimeout</i>. We recommend setting the <i>expiryTimeout</i> immediately after creating the thread pool, but before calling <a href="qthreadpool.html#start">start</a>().</p> <p><b>Access functions:</b></p> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>expiryTimeout</b></span>() const</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setExpiryTimeout</b></span>(int <i>expiryTimeout</i>)</td></tr> </table></div> <!-- @@@expiryTimeout --> <!-- $$$maxThreadCount-prop$$$maxThreadCount$$$setMaxThreadCountint --> <h3 class="fn" id="maxThreadCount-prop"><a name="maxThreadCount-prop"></a><span class="name">maxThreadCount</span> : <span class="type">int</span></h3> <p>This property represents the maximum number of threads used by the thread pool.</p> <p><b>Note: </b>The thread pool will always use at least 1 thread, even if <i>maxThreadCount</i> limit is zero or negative.</p><p>The default <i>maxThreadCount</i> is <a href="qthread.html#idealThreadCount">QThread::idealThreadCount</a>().</p> <p><b>Access functions:</b></p> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>maxThreadCount</b></span>() const</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setMaxThreadCount</b></span>(int <i>maxThreadCount</i>)</td></tr> </table></div> <!-- @@@maxThreadCount --> <!-- $$$stackSize-prop$$$stackSize$$$setStackSizeuint --> <h3 class="fn" id="stackSize-prop"><a name="stackSize-prop"></a><span class="name">stackSize</span> : <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span></h3> <p>This property contains the stack size for the thread pool worker threads.</p> <p>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.</p> <p>The default value is 0, which makes <a href="qthread.html">QThread</a> use the operating system default stack size.</p> <p>This property was introduced in Qt 5.10.</p> <p><b>Access functions:</b></p> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> uint </td><td class="memItemRight bottomAlign"><span class="name"><b>stackSize</b></span>() const</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setStackSize</b></span>(uint <i>stackSize</i>)</td></tr> </table></div> <!-- @@@stackSize --> </div> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QThreadPool[overload1]$$$QThreadPoolQObject* --> <h3 class="fn" id="QThreadPool"><a name="QThreadPool"></a>QThreadPool::<span class="name">QThreadPool</span>(<span class="type"><a href="qobject.html#QObject">QObject</a></span> *<i>parent</i> = nullptr)</h3> <p>Constructs a thread pool with the given <i>parent</i>.</p> <!-- @@@QThreadPool --> <!-- $$$~QThreadPool[overload1]$$$~QThreadPool --> <h3 class="fn" id="dtor.QThreadPool"><a name="dtor.QThreadPool"></a><code>[virtual] </code>QThreadPool::<span class="name">~QThreadPool</span>()</h3> <p>Destroys the <a href="qthreadpool.html">QThreadPool</a>. This function will block until all runnables have been completed.</p> <!-- @@@~QThreadPool --> <!-- $$$clear[overload1]$$$clear --> <h3 class="fn" id="clear"><a name="clear"></a><span class="type">void</span> QThreadPool::<span class="name">clear</span>()</h3> <p>Removes the runnables that are not yet started from the queue. The runnables for which <a href="qrunnable.html#autoDelete">runnable->autoDelete()</a> returns <code>true</code> are deleted.</p> <p>This function was introduced in Qt 5.2.</p> <p><b>See also </b><a href="qthreadpool.html#start">start</a>().</p> <!-- @@@clear --> <!-- $$$globalInstance[overload1]$$$globalInstance --> <h3 class="fn" id="globalInstance"><a name="globalInstance"></a><code>[static] </code><span class="type"><a href="qthreadpool.html#QThreadPool">QThreadPool</a></span> *QThreadPool::<span class="name">globalInstance</span>()</h3> <p>Returns the global <a href="qthreadpool.html">QThreadPool</a> instance.</p> <!-- @@@globalInstance --> <!-- $$$releaseThread[overload1]$$$releaseThread --> <h3 class="fn" id="releaseThread"><a name="releaseThread"></a><span class="type">void</span> QThreadPool::<span class="name">releaseThread</span>()</h3> <p>Releases a thread previously reserved by a call to <a href="qthreadpool.html#reserveThread">reserveThread</a>().</p> <p><b>Note: </b>Calling this function without previously reserving a thread temporarily increases <a href="qthreadpool.html#maxThreadCount-prop">maxThreadCount</a>(). This is useful when a thread goes to sleep waiting for more work, allowing other threads to continue. Be sure to call <a href="qthreadpool.html#reserveThread">reserveThread</a>() when done waiting, so that the thread pool can correctly maintain the <a href="qthreadpool.html#activeThreadCount-prop">activeThreadCount</a>().</p><p><b>See also </b><a href="qthreadpool.html#reserveThread">reserveThread</a>().</p> <!-- @@@releaseThread --> <!-- $$$reserveThread[overload1]$$$reserveThread --> <h3 class="fn" id="reserveThread"><a name="reserveThread"></a><span class="type">void</span> QThreadPool::<span class="name">reserveThread</span>()</h3> <p>Reserves one thread, disregarding <a href="qthreadpool.html#activeThreadCount-prop">activeThreadCount</a>() and <a href="qthreadpool.html#maxThreadCount-prop">maxThreadCount</a>().</p> <p>Once you are done with the thread, call <a href="qthreadpool.html#releaseThread">releaseThread</a>() to allow it to be reused.</p> <p><b>Note: </b>This function will always increase the number of active threads. This means that by using this function, it is possible for <a href="qthreadpool.html#activeThreadCount-prop">activeThreadCount</a>() to return a value greater than <a href="qthreadpool.html#maxThreadCount-prop">maxThreadCount</a>() .</p><p><b>See also </b><a href="qthreadpool.html#releaseThread">releaseThread</a>().</p> <!-- @@@reserveThread --> <!-- $$$start[overload1]$$$startQRunnable*int --> <h3 class="fn" id="start"><a name="start"></a><span class="type">void</span> QThreadPool::<span class="name">start</span>(<span class="type"><a href="qrunnable.html">QRunnable</a></span> *<i>runnable</i>, <span class="type">int</span> <i>priority</i> = 0)</h3> <p>Reserves a thread and uses it to run <i>runnable</i>, unless this thread will make the current thread count exceed <a href="qthreadpool.html#maxThreadCount-prop">maxThreadCount</a>(). In that case, <i>runnable</i> is added to a run queue instead. The <i>priority</i> argument can be used to control the run queue's order of execution.</p> <p>Note that the thread pool takes ownership of the <i>runnable</i> if <a href="qrunnable.html#autoDelete">runnable->autoDelete()</a> returns <code>true</code>, and the <i>runnable</i> will be deleted automatically by the thread pool after the <a href="qrunnable.html#run">runnable->run()</a> returns. If <a href="qrunnable.html#autoDelete">runnable->autoDelete()</a> returns <code>false</code>, ownership of <i>runnable</i> remains with the caller. Note that changing the auto-deletion on <i>runnable</i> after calling this functions results in undefined behavior.</p> <!-- @@@start --> <!-- $$$tryStart[overload1]$$$tryStartQRunnable* --> <h3 class="fn" id="tryStart"><a name="tryStart"></a><span class="type">bool</span> QThreadPool::<span class="name">tryStart</span>(<span class="type"><a href="qrunnable.html">QRunnable</a></span> *<i>runnable</i>)</h3> <p>Attempts to reserve a thread to run <i>runnable</i>.</p> <p>If no threads are available at the time of calling, then this function does nothing and returns <code>false</code>. Otherwise, <i>runnable</i> is run immediately using one available thread and this function returns <code>true</code>.</p> <p>Note that the thread pool takes ownership of the <i>runnable</i> if <a href="qrunnable.html#autoDelete">runnable->autoDelete()</a> returns <code>true</code>, and the <i>runnable</i> will be deleted automatically by the thread pool after the <a href="qrunnable.html#run">runnable->run()</a> returns. If <a href="qrunnable.html#autoDelete">runnable->autoDelete()</a> returns <code>false</code>, ownership of <i>runnable</i> remains with the caller. Note that changing the auto-deletion on <i>runnable</i> after calling this function results in undefined behavior.</p> <!-- @@@tryStart --> <!-- $$$tryTake[overload1]$$$tryTakeQRunnable* --> <h3 class="fn" id="tryTake"><a name="tryTake"></a><span class="type">bool</span> QThreadPool::<span class="name">tryTake</span>(<span class="type"><a href="qrunnable.html">QRunnable</a></span> *<i>runnable</i>)</h3> <p>Attempts to remove the specified <i>runnable</i> from the queue if it is not yet started. If the runnable had not been started, returns <code>true</code>, and ownership of <i>runnable</i> is transferred to the caller (even when <code>runnable->autoDelete() == true</code>). Otherwise returns <code>false</code>.</p> <p><b>Note: </b>If <code>runnable->autoDelete() == true</code>, this function may remove the wrong runnable. This is known as the <a href="https://en.wikipedia.org/wiki/ABA_problem">ABA problem</a>: the original <i>runnable</i> may already have executed and has since been deleted. The memory is re-used for another runnable, which then gets removed instead of the intended one. For this reason, we recommend calling this function only for runnables that are not auto-deleting.</p><p>This function was introduced in Qt 5.9.</p> <p><b>See also </b><a href="qthreadpool.html#start">start</a>() and <a href="qrunnable.html#autoDelete">QRunnable::autoDelete</a>().</p> <!-- @@@tryTake --> <!-- $$$waitForDone[overload1]$$$waitForDoneint --> <h3 class="fn" id="waitForDone"><a name="waitForDone"></a><span class="type">bool</span> QThreadPool::<span class="name">waitForDone</span>(<span class="type">int</span> <i>msecs</i> = -1)</h3> <p>Waits up to <i>msecs</i> milliseconds for all threads to exit and removes all threads from the thread pool. Returns <code>true</code> if all threads were removed; otherwise it returns <code>false</code>. If <i>msecs</i> is -1 (the default), the timeout is ignored (waits for the last thread to exit).</p> <!-- @@@waitForDone --> </div> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2019 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.<br/> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br/> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. </p> </div> </body> </html>