Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 28b9e36e96ce34b2567ae5b47a27b2c5 > files > 1293

python-qt4-doc-4.10.3-3.mga4.noarch.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QWriteLocker Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QWriteLocker Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QWriteLocker class is a convenience class that simplifies
locking and unlocking read-write locks for write access. <a href="#details">More...</a></p>

<h3>Methods</h3><ul><li><div class="fn" /><b><a href="qwritelocker.html#QWriteLocker">__init__</a></b> (<i>self</i>, QReadWriteLock&#160;<i>areadWriteLock</i>)</li><li><div class="fn" />QReadWriteLock <b><a href="qwritelocker.html#readWriteLock">readWriteLock</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qwritelocker.html#relock">relock</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qwritelocker.html#unlock">unlock</a></b> (<i>self</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />object <b><a href="qwritelocker.html#__enter__">__enter__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qwritelocker.html#__exit__">__exit__</a></b> (<i>self</i>, object&#160;<i>type</i>, object&#160;<i>value</i>, object&#160;<i>traceback</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QWriteLocker class is a convenience class that simplifies
locking and unlocking read-write locks for write access.</p>
<p>The purpose of QWriteLocker (and <a href="qreadlocker.html">QReadLocker</a> is to simplify <a href="qreadwritelock.html">QReadWriteLock</a> locking and unlocking.
Locking and unlocking statements or in exception handling code is
error-prone and difficult to debug. QWriteLocker can be used in
such situations to ensure that the state of the lock is always
well-defined.</p>
<p>Here's an example that uses QWriteLocker to lock and unlock a
read-write lock for writing:</p>
<pre class="cpp">
 <span class="type"><a href="qreadwritelock.html">QReadWriteLock</a></span> lock;

 <span class="type">void</span> writeData(<span class="keyword">const</span> <span class="type"><a href="qbytearray.html">QByteArray</a></span> <span class="operator">&amp;</span>data)
 {
     <span class="type">QWriteLocker</span> locker(<span class="operator">&amp;</span>lock);
     <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
 }
</pre>
<p>It is equivalent to the following code:</p>
<pre class="cpp">
 <span class="type"><a href="qreadwritelock.html">QReadWriteLock</a></span> lock;

 <span class="type">void</span> writeData(<span class="keyword">const</span> <span class="type"><a href="qbytearray.html">QByteArray</a></span> <span class="operator">&amp;</span>data)
 {
     lock<span class="operator">.</span>lockForWrite();
     <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
     lock<span class="operator">.</span>unlock();
 }
</pre>
<p>The <a href="qmutexlocker.html">QMutexLocker</a> documentation
shows examples where the use of a locker object greatly simplifies
programming.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QWriteLocker" />QWriteLocker.__init__ (<i>self</i>, <a href="qreadwritelock.html">QReadWriteLock</a>&#160;<i>areadWriteLock</i>)</h3><p>Constructs a <a href="qwritelocker.html">QWriteLocker</a> and
locks <i>lock</i> for writing. The lock will be unlocked when the
<a href="qwritelocker.html">QWriteLocker</a> is destroyed. If
<tt>lock</tt> is zero, <a href="qwritelocker.html">QWriteLocker</a>
does nothing.</p>
<p><b>See also</b> <a href="qreadwritelock.html#lockForWrite">QReadWriteLock.lockForWrite</a>().</p>


<h3 class="fn"><a name="readWriteLock" /><a href="qreadwritelock.html">QReadWriteLock</a> QWriteLocker.readWriteLock (<i>self</i>)</h3><p>Returns a pointer to the read-write lock that was passed to the
constructor.</p>


<h3 class="fn"><a name="relock" />QWriteLocker.relock (<i>self</i>)</h3><p>Relocks an unlocked lock.</p>
<p><b>See also</b> <a href="qwritelocker.html#unlock">unlock</a>().</p>


<h3 class="fn"><a name="unlock" />QWriteLocker.unlock (<i>self</i>)</h3><p>Unlocks the lock associated with this locker.</p>
<p><b>See also</b> <a href="qreadwritelock.html#unlock">QReadWriteLock.unlock</a>().</p>
<h3 class="fn"><a name="__enter__" />object QWriteLocker.__enter__ (<i>self</i>)</h3><h3 class="fn"><a name="__exit__" />QWriteLocker.__exit__ (<i>self</i>, object&#160;<i>type</i>, object&#160;<i>value</i>, object&#160;<i>traceback</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.10.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.5</td></tr></table></div></address></body></html>