Sophie

Sophie

distrib > Mageia > 6 > armv5tl > media > core-updates > by-pkgid > 768f7d9f703884aa2562bf0a651086df > files > 398

qtbase5-doc-5.9.4-1.1.mga6.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qfuturesynchronizer.qdoc -->
  <title>QFutureSynchronizer Class | Qt Core 5.9</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.9</td><td ><a href="qtcore-index.html">Qt Core</a></td><td ><a href="qtcore-module.html">C++ Classes</a></td><td >QFutureSynchronizer</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</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="#public-functions">Public Functions</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">QFutureSynchronizer Class</h1>
<!-- $$$QFutureSynchronizer-brief -->
<p>The <a href="qfuturesynchronizer.html">QFutureSynchronizer</a> class is a convenience class that simplifies <a href="qfuture.html">QFuture</a> synchronization. <a href="#details">More...</a></p>
<!-- @@@QFutureSynchronizer -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QFutureSynchronizer&gt;</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></table></div><ul>
<li><a href="qfuturesynchronizer-members.html">List of all members, including inherited members</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="qfuturesynchronizer.html#QFutureSynchronizer">QFutureSynchronizer</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qfuturesynchronizer.html#QFutureSynchronizer-1">QFutureSynchronizer</a></b>(const QFuture&lt;T&gt; &amp;<i>future</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qfuturesynchronizer.html#dtor.QFutureSynchronizer">~QFutureSynchronizer</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfuturesynchronizer.html#addFuture">addFuture</a></b>(const QFuture&lt;T&gt; &amp;<i>future</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qfuturesynchronizer.html#cancelOnWait">cancelOnWait</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfuturesynchronizer.html#clearFutures">clearFutures</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QFuture&lt;T&gt; &gt; </td><td class="memItemRight bottomAlign"><b><a href="qfuturesynchronizer.html#futures">futures</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfuturesynchronizer.html#setCancelOnWait">setCancelOnWait</a></b>(bool <i>enabled</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfuturesynchronizer.html#setFuture">setFuture</a></b>(const QFuture&lt;T&gt; &amp;<i>future</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qfuturesynchronizer.html#waitForFinished">waitForFinished</a></b>()</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QFutureSynchronizer-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qfuturesynchronizer.html">QFutureSynchronizer</a> class is a convenience class that simplifies <a href="qfuture.html">QFuture</a> synchronization.</p>
<p><a href="qfuturesynchronizer.html">QFutureSynchronizer</a> is a template class that simplifies synchronization of one or more <a href="qfuture.html">QFuture</a> objects. Futures are added using the <a href="qfuturesynchronizer.html#addFuture">addFuture</a>() or <a href="qfuturesynchronizer.html#setFuture">setFuture</a>() functions. The <a href="qfuturesynchronizer.html#futures">futures</a>() function returns a list of futures. Use <a href="qfuturesynchronizer.html#clearFutures">clearFutures</a>() to remove all futures from the <a href="qfuturesynchronizer.html">QFutureSynchronizer</a>.</p>
<p>The <a href="qfuturesynchronizer.html#waitForFinished">waitForFinished</a>() function waits for all futures to finish. The destructor of <a href="qfuturesynchronizer.html">QFutureSynchronizer</a> calls <a href="qfuturesynchronizer.html#waitForFinished">waitForFinished</a>(), providing an easy way to ensure that all futures have finished before returning from a function:</p>
<pre class="cpp">

  <span class="type">void</span> someFunction()
  {
      <span class="type"><a href="qfuturesynchronizer.html#QFutureSynchronizer">QFutureSynchronizer</a></span><span class="operator">&lt;</span><span class="type">void</span><span class="operator">&gt;</span> synchronizer;

      <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>

      synchronizer<span class="operator">.</span>addFuture(<span class="type"><a href="../qtconcurrent/qtconcurrent.html">QtConcurrent</a></span><span class="operator">::</span>run(anotherFunction));
      synchronizer<span class="operator">.</span>addFuture(<span class="type"><a href="../qtconcurrent/qtconcurrent.html">QtConcurrent</a></span><span class="operator">::</span>map(list<span class="operator">,</span> mapFunction));

      <span class="keyword">return</span>; <span class="comment">// QFutureSynchronizer waits for all futures to finish</span>
  }

</pre>
<p>The behavior of <a href="qfuturesynchronizer.html#waitForFinished">waitForFinished</a>() can be changed using the <a href="qfuturesynchronizer.html#setCancelOnWait">setCancelOnWait</a>() function. Calling <a href="qfuturesynchronizer.html#setCancelOnWait">setCancelOnWait</a>(true) will cause <a href="qfuturesynchronizer.html#waitForFinished">waitForFinished</a>() to cancel all futures before waiting for them to finish. You can query the status of the cancel-on-wait feature using the <a href="qfuturesynchronizer.html#cancelOnWait">cancelOnWait</a>() function.</p>
</div>
<p><b>See also </b><a href="qfuture.html">QFuture</a>, <a href="qfuturewatcher.html">QFutureWatcher</a>, and <a href="../qtconcurrent/qtconcurrent-index.html">Qt Concurrent</a>.</p>
<!-- @@@QFutureSynchronizer -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QFutureSynchronizer[overload1]$$$QFutureSynchronizer -->
<h3 class="fn" id="QFutureSynchronizer"><a name="QFutureSynchronizer"></a>QFutureSynchronizer::<span class="name">QFutureSynchronizer</span>()</h3>
<p>Constructs a <a href="qfuturesynchronizer.html">QFutureSynchronizer</a>.</p>
<!-- @@@QFutureSynchronizer -->
<!-- $$$QFutureSynchronizer$$$QFutureSynchronizerconstQFuture<T>& -->
<h3 class="fn" id="QFutureSynchronizer-1"><a name="QFutureSynchronizer-1"></a>QFutureSynchronizer::<span class="name">QFutureSynchronizer</span>(const <span class="type"><a href="qfuture.html">QFuture</a></span>&lt;<span class="type">T</span>&gt; &amp;<i>future</i>)</h3>
<p>Constructs a <a href="qfuturesynchronizer.html">QFutureSynchronizer</a> and begins watching <i>future</i> by calling <a href="qfuturesynchronizer.html#addFuture">addFuture</a>().</p>
<p><b>See also </b><a href="qfuturesynchronizer.html#addFuture">addFuture</a>().</p>
<!-- @@@QFutureSynchronizer -->
<!-- $$$~QFutureSynchronizer[overload1]$$$~QFutureSynchronizer -->
<h3 class="fn" id="dtor.QFutureSynchronizer"><a name="dtor.QFutureSynchronizer"></a>QFutureSynchronizer::<span class="name">~QFutureSynchronizer</span>()</h3>
<p>Calls <a href="qfuturesynchronizer.html#waitForFinished">waitForFinished</a>() function to ensure that all futures have finished before destroying this <a href="qfuturesynchronizer.html">QFutureSynchronizer</a>.</p>
<p><b>See also </b><a href="qfuturesynchronizer.html#waitForFinished">waitForFinished</a>().</p>
<!-- @@@~QFutureSynchronizer -->
<!-- $$$addFuture[overload1]$$$addFutureconstQFuture<T>& -->
<h3 class="fn" id="addFuture"><a name="addFuture"></a><span class="type">void</span> QFutureSynchronizer::<span class="name">addFuture</span>(const <span class="type"><a href="qfuture.html">QFuture</a></span>&lt;<span class="type">T</span>&gt; &amp;<i>future</i>)</h3>
<p>Adds <i>future</i> to the list of managed futures.</p>
<p><b>See also </b><a href="qfuturesynchronizer.html#futures">futures</a>().</p>
<!-- @@@addFuture -->
<!-- $$$cancelOnWait[overload1]$$$cancelOnWait -->
<h3 class="fn" id="cancelOnWait"><a name="cancelOnWait"></a><span class="type">bool</span> QFutureSynchronizer::<span class="name">cancelOnWait</span>() const</h3>
<p>Returns <code>true</code> if the cancel-on-wait feature is enabled; otherwise returns false. If cancel-on-wait is enabled, the <a href="qfuturesynchronizer.html#waitForFinished">waitForFinished</a>() function will cancel all futures before waiting for them to finish.</p>
<p><b>See also </b><a href="qfuturesynchronizer.html#setCancelOnWait">setCancelOnWait</a>() and <a href="qfuturesynchronizer.html#waitForFinished">waitForFinished</a>().</p>
<!-- @@@cancelOnWait -->
<!-- $$$clearFutures[overload1]$$$clearFutures -->
<h3 class="fn" id="clearFutures"><a name="clearFutures"></a><span class="type">void</span> QFutureSynchronizer::<span class="name">clearFutures</span>()</h3>
<p>Removes all managed futures from this <a href="qfuturesynchronizer.html">QFutureSynchronizer</a>.</p>
<p><b>See also </b><a href="qfuturesynchronizer.html#addFuture">addFuture</a>() and <a href="qfuturesynchronizer.html#setFuture">setFuture</a>().</p>
<!-- @@@clearFutures -->
<!-- $$$futures[overload1]$$$futures -->
<h3 class="fn" id="futures"><a name="futures"></a><span class="type"><a href="qlist.html">QList</a></span>&lt;<span class="type"><a href="qfuture.html">QFuture</a></span>&lt;<span class="type">T</span>&gt; &gt; QFutureSynchronizer::<span class="name">futures</span>() const</h3>
<p>Returns a list of all managed futures.</p>
<p><b>See also </b><a href="qfuturesynchronizer.html#addFuture">addFuture</a>() and <a href="qfuturesynchronizer.html#setFuture">setFuture</a>().</p>
<!-- @@@futures -->
<!-- $$$setCancelOnWait[overload1]$$$setCancelOnWaitbool -->
<h3 class="fn" id="setCancelOnWait"><a name="setCancelOnWait"></a><span class="type">void</span> QFutureSynchronizer::<span class="name">setCancelOnWait</span>(<span class="type">bool</span> <i>enabled</i>)</h3>
<p>Enables or disables the cancel-on-wait feature based on the <i>enabled</i> argument. If <i>enabled</i> is true, the <a href="qfuturesynchronizer.html#waitForFinished">waitForFinished</a>() function will cancel all futures before waiting for them to finish.</p>
<p><b>See also </b><a href="qfuturesynchronizer.html#cancelOnWait">cancelOnWait</a>() and <a href="qfuturesynchronizer.html#waitForFinished">waitForFinished</a>().</p>
<!-- @@@setCancelOnWait -->
<!-- $$$setFuture[overload1]$$$setFutureconstQFuture<T>& -->
<h3 class="fn" id="setFuture"><a name="setFuture"></a><span class="type">void</span> QFutureSynchronizer::<span class="name">setFuture</span>(const <span class="type"><a href="qfuture.html">QFuture</a></span>&lt;<span class="type">T</span>&gt; &amp;<i>future</i>)</h3>
<p>Sets <i>future</i> to be the only future managed by this <a href="qfuturesynchronizer.html">QFutureSynchronizer</a>. This is a convenience function that calls <a href="qfuturesynchronizer.html#waitForFinished">waitForFinished</a>(), then <a href="qfuturesynchronizer.html#clearFutures">clearFutures</a>(), and finally passes <i>future</i> to <a href="qfuturesynchronizer.html#addFuture">addFuture</a>().</p>
<p><b>See also </b><a href="qfuturesynchronizer.html#addFuture">addFuture</a>(), <a href="qfuturesynchronizer.html#waitForFinished">waitForFinished</a>(), and <a href="qfuturesynchronizer.html#clearFutures">clearFutures</a>().</p>
<!-- @@@setFuture -->
<!-- $$$waitForFinished[overload1]$$$waitForFinished -->
<h3 class="fn" id="waitForFinished"><a name="waitForFinished"></a><span class="type">void</span> QFutureSynchronizer::<span class="name">waitForFinished</span>()</h3>
<p>Waits for all futures to finish. If <a href="qfuturesynchronizer.html#cancelOnWait">cancelOnWait</a>() returns <code>true</code>, each future is canceled before waiting for them to finish.</p>
<p><b>See also </b><a href="qfuturesynchronizer.html#cancelOnWait">cancelOnWait</a>() and <a href="qfuturesynchronizer.html#setCancelOnWait">setCancelOnWait</a>().</p>
<!-- @@@waitForFinished -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2017 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>