/usr/share/qt5/doc/qtdoc/threads-modules.html is in qt5-doc-html 5.3.2-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- threads.qdoc -->
<title>Thread-Support in Qt Modules | QtDoc 5.3</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="main">
<div class="main-rounded">
<div class="navigationbar">
<ul>
<li><a href="index.html">Qt 5.3</a></li>
<li>Thread-Support in Qt Modules</li>
<li id="buildversion">
Qt 5.3.2 Reference Documentation</li>
</ul>
</div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<link rel="prev" href="threads-qobject.html" />
<p class="naviNextPrevious headerNavi">
<a class="prevPage" href="threads-qobject.html">Threads and QObjects</a>
</p><p/>
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#threads-and-the-sql-module">Threads and the SQL Module</a></li>
<li class="level1"><a href="#painting-in-threads">Painting in Threads</a></li>
<li class="level1"><a href="#threads-and-rich-text-processing">Threads and Rich Text Processing</a></li>
<li class="level1"><a href="#threads-and-the-svg-module">Threads and the SVG module</a></li>
<li class="level1"><a href="#threads-and-implicitly-shared-classes">Threads and Implicitly Shared Classes</a></li>
</ul>
</div>
<h1 class="title">Thread-Support in Qt Modules</h1>
<span class="subtitle"></span>
<!-- $$$threads-modules.html-description -->
<div class="descr"> <a name="details"></a>
<a name="threads-and-the-sql-module"></a>
<h2>Threads and the SQL Module</h2>
<p>A connection can only be used from within the thread that created it. Moving connections between threads or creating queries from a different thread is not supported.</p>
<p>In addition, the third party libraries used by the QSqlDrivers can impose further restrictions on using the SQL Module in a multithreaded program. Consult the manual of your database client for more information</p>
<a name="painting-in-threads"></a>
<h2>Painting in Threads</h2>
<p><a href="../qtgui/qpainter.html">QPainter</a> can be used in a thread to paint onto <a href="../qtgui/qimage.html">QImage</a>, <a href="../qtprintsupport/qprinter.html">QPrinter</a>, and <a href="../qtgui/qpicture.html">QPicture</a> paint devices. Painting onto QPixmaps and QWidgets is <i>not</i> supported. On Mac OS X the automatic progress dialog will not be displayed if you are printing from outside the GUI thread.</p>
<p>Any number of threads can paint at any given time, however only one thread at a time can paint on a given paint device. In other words, two threads can paint at the same time if each paints onto separate QImages, but the two threads cannot paint onto the same <a href="../qtgui/qimage.html">QImage</a> at the same time.</p>
<a name="threads-and-rich-text-processing"></a>
<h2>Threads and Rich Text Processing</h2>
<p>The <a href="../qtgui/qtextdocument.html">QTextDocument</a>, <a href="../qtgui/qtextcursor.html">QTextCursor</a>, and <a href="../qtgui/richtext.html">all related classes</a> are reentrant.</p>
<p>Note that a <a href="../qtgui/qtextdocument.html">QTextDocument</a> instance created in the GUI thread may contain <a href="../qtgui/qpixmap.html">QPixmap</a> image resources. Use <a href="../qtgui/qtextdocument.html#clone">QTextDocument::clone</a>() to create a copy of the document, and pass the copy to another thread for further processing (such as printing).</p>
<a name="threads-and-the-svg-module"></a>
<h2>Threads and the SVG module</h2>
<p>The <a href="../qtsvg/qsvggenerator.html">QSvgGenerator</a> and <a href="../qtsvg/qsvgrenderer.html">QSvgRenderer</a> classes in the <a href="../qtsvg/qtsvg-module.html">QtSvg</a> module are reentrant.</p>
<a name="threads-and-implicitly-shared-classes"></a>
<h2>Threads and Implicitly Shared Classes</h2>
<p>Qt uses an optimization called <a href="../qtcore/implicit-sharing.html">implicit sharing</a> for many of its value class, notably <a href="../qtgui/qimage.html">QImage</a> and <a href="../qtcore/qstring.html">QString</a>. Beginning with Qt 4, implicit shared classes can safely be copied across threads, like any other value classes. They are fully <a href="threads-reentrancy.html">reentrant</a>. The implicit sharing is really <i>implicit</i>.</p>
<p>In many people's minds, implicit sharing and multithreading are incompatible concepts, because of the way the reference counting is typically done. Qt, however, uses atomic reference counting to ensure the integrity of the shared data, avoiding potential corruption of the reference counter.</p>
<p>Note that atomic reference counting does not guarantee <a href="threads-reentrancy.html">thread-safety</a>. Proper locking should be used when sharing an instance of an implicitly shared class between threads. This is the same requirement placed on all <a href="threads-reentrancy.html">reentrant</a> classes, shared or not. Atomic reference counting does, however, guarantee that a thread working on its own, local instance of an implicitly shared class is safe. We recommend using <a href="threads-qobject.html#signals-and-slots-across-threads">signals and slots</a> to pass data between threads, as this can be done without the need for any explicit locking.</p>
<p>To sum it up, implicitly shared classes in Qt 4 are really <i>implicitly</i> shared. Even in multithreaded applications, you can safely use them as if they were plain, non-shared, reentrant value-based classes.</p>
</div>
<!-- @@@threads-modules.html -->
<p class="naviNextPrevious footerNavi">
<a class="prevPage" href="threads-qobject.html">Threads and QObjects</a>
</p>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2014 Digia Plc and/or its
subsidiaries. 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> Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. </p>
</div>
</body>
</html>
|