Sophie

Sophie

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

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" />
<!-- qrunnable.cpp -->
  <title>QRunnable 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 >QRunnable</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">QRunnable Class</h1>
<!-- $$$QRunnable-brief -->
<p>The <a href="qrunnable.html">QRunnable</a> class is the base class for all runnable objects. <a href="#details">More...</a></p>
<!-- @@@QRunnable -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QRunnable&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="qrunnable-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="qrunnable.html#QRunnable">QRunnable</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qrunnable.html#dtor.QRunnable">~QRunnable</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qrunnable.html#autoDelete">autoDelete</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qrunnable.html#run">run</a></b>() = 0</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qrunnable.html#setAutoDelete">setAutoDelete</a></b>(bool <i>autoDelete</i>)</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QRunnable-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qrunnable.html">QRunnable</a> class is the base class for all runnable objects.</p>
<p>The <a href="qrunnable.html">QRunnable</a> class is an interface for representing a task or piece of code that needs to be executed, represented by your reimplementation of the <a href="qrunnable.html#run">run</a>() function.</p>
<p>You can use <a href="qthreadpool.html">QThreadPool</a> to execute your code in a separate thread. <a href="qthreadpool.html">QThreadPool</a> deletes the <a href="qrunnable.html">QRunnable</a> automatically if <a href="qrunnable.html#autoDelete">autoDelete</a>() returns <code>true</code> (the default). Use <a href="qrunnable.html#setAutoDelete">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">QThreadPool::tryStart</a>(this) from within the <a href="qrunnable.html#run">run</a>() function. If <a href="qrunnable.html#autoDelete">autoDelete</a> 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">QThreadPool::start</a>() multiple times with the same <a href="qrunnable.html">QRunnable</a> when <a href="qrunnable.html#autoDelete">autoDelete</a> is enabled creates a race condition and is not recommended.</p>
</div>
<p><b>See also </b><a href="qthreadpool.html">QThreadPool</a>.</p>
<!-- @@@QRunnable -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QRunnable[overload1]$$$QRunnable -->
<h3 class="fn" id="QRunnable"><a name="QRunnable"></a>QRunnable::<span class="name">QRunnable</span>()</h3>
<p>Constructs a <a href="qrunnable.html">QRunnable</a>. Auto-deletion is enabled by default.</p>
<p><b>See also </b><a href="qrunnable.html#autoDelete">autoDelete</a>() and <a href="qrunnable.html#setAutoDelete">setAutoDelete</a>().</p>
<!-- @@@QRunnable -->
<!-- $$$~QRunnable[overload1]$$$~QRunnable -->
<h3 class="fn" id="dtor.QRunnable"><a name="dtor.QRunnable"></a><code>[virtual] </code>QRunnable::<span class="name">~QRunnable</span>()</h3>
<p><a href="qrunnable.html">QRunnable</a> virtual destructor.</p>
<!-- @@@~QRunnable -->
<!-- $$$autoDelete[overload1]$$$autoDelete -->
<h3 class="fn" id="autoDelete"><a name="autoDelete"></a><span class="type">bool</span> QRunnable::<span class="name">autoDelete</span>() const</h3>
<p>Returns <code>true</code> is auto-deletion is enabled; false otherwise.</p>
<p>If auto-deletion is enabled, <a href="qthreadpool.html">QThreadPool</a> will automatically delete this runnable after calling <a href="qrunnable.html#run">run</a>(); otherwise, ownership remains with the application programmer.</p>
<p><b>See also </b><a href="qrunnable.html#setAutoDelete">setAutoDelete</a>() and <a href="qthreadpool.html">QThreadPool</a>.</p>
<!-- @@@autoDelete -->
<!-- $$$run[overload1]$$$run -->
<h3 class="fn" id="run"><a name="run"></a><code>[pure virtual] </code><span class="type">void</span> QRunnable::<span class="name">run</span>()</h3>
<p>Implement this pure virtual function in your subclass.</p>
<!-- @@@run -->
<!-- $$$setAutoDelete[overload1]$$$setAutoDeletebool -->
<h3 class="fn" id="setAutoDelete"><a name="setAutoDelete"></a><span class="type">void</span> QRunnable::<span class="name">setAutoDelete</span>(<span class="type">bool</span> <i>autoDelete</i>)</h3>
<p>Enables auto-deletion if <i>autoDelete</i> is true; otherwise auto-deletion is disabled.</p>
<p>If auto-deletion is enabled, <a href="qthreadpool.html">QThreadPool</a> will automatically delete this runnable after calling <a href="qrunnable.html#run">run</a>(); otherwise, ownership remains with the application programmer.</p>
<p>Note that this flag must be set before calling <a href="qthreadpool.html#start">QThreadPool::start</a>(). Calling this function after <a href="qthreadpool.html#start">QThreadPool::start</a>() results in undefined behavior.</p>
<p><b>See also </b><a href="qrunnable.html#autoDelete">autoDelete</a>() and <a href="qthreadpool.html">QThreadPool</a>.</p>
<!-- @@@setAutoDelete -->
</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>