<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- /tmp/qt-3.0-reggie-28534/qt-x11-free-3.0.2/src/kernel/qlock_qws.cpp:64 --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>QLock Class</title> <style type="text/css"><!-- h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } body { background: #ffffff; color: black; } --></style> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr bgcolor="#E5E5E5"> <td valign=center> <a href="index.html"> <font color="#004faf">Home</font></a> | <a href="classes.html"> <font color="#004faf">All Classes</font></a> | <a href="mainclasses.html"> <font color="#004faf">Main Classes</font></a> | <a href="annotated.html"> <font color="#004faf">Annotated</font></a> | <a href="groups.html"> <font color="#004faf">Grouped Classes</font></a> | <a href="functions.html"> <font color="#004faf">Functions</font></a> </td> <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QLock Class Reference</h1> <p>The QLock class is a wrapper round a System V shared semaphore. <a href="#details">More...</a> <p><tt>#include <<a href="qlock_qws-h.html">qlock_qws.h</a>></tt> <p><a href="qlock-members.html">List of all member functions.</a> <h2>Public Members</h2> <ul> <li><div class=fn><a href="#QLock"><b>QLock</b></a> ( const QString & filename, char id, bool create = FALSE )</div></li> <li><div class=fn><a href="#~QLock"><b>~QLock</b></a> ()</div></li> <li><div class=fn>enum <a href="#Type-enum"><b>Type</b></a> { Read, Write }</div></li> <li><div class=fn>bool <a href="#isValid"><b>isValid</b></a> () const</div></li> <li><div class=fn>void <a href="#lock"><b>lock</b></a> ( Type t )</div></li> <li><div class=fn>void <a href="#unlock"><b>unlock</b></a> ()</div></li> <li><div class=fn>bool <a href="#locked"><b>locked</b></a> () const</div></li> </ul> <hr><a name="details"></a><h2>Detailed Description</h2> The QLock class is a wrapper round a System V shared semaphore. <p> It is used by Qt/Embedded for synchronizing access to the graphics card and shared memory region between processes. <p>See also <a href="io.html">Input/Output and Networking</a> and <a href="qws.html">Qt/Embedded</a>. <hr><h2>Member Type Documentation</h2> <h3 class=fn><a name="Type-enum"></a>QLock::Type</h3> <ul> <li><tt>QLock::Read</tt> <li><tt>QLock::Write</tt> </ul> <hr><h2>Member Function Documentation</h2> <h3 class=fn><a name="QLock"></a>QLock::QLock ( const <a href="qstring.html">QString</a> & filename, char id, bool create = FALSE ) </h3> Creates a lock. <em>filename</em> is the file path of the Unix-domain socket the Qt/Embedded client is using. <em>id</em> is the name of the particular lock to be created on that socket. If <em>create</em> is TRUE the lock is to be created (as the Qt/Embedded server does); if <em>create</em> is FALSE the lock should exist already (as the Qt/Embedded client expects). <h3 class=fn><a name="~QLock"></a>QLock::~QLock () </h3> Destroys a lock <h3 class=fn>bool <a name="isValid"></a>QLock::isValid () const </h3> Returns TRUE if the lock constructor was succesful; returns FALSE if the lock could not be created or was not available to connect to. <h3 class=fn>void <a name="lock"></a>QLock::lock ( <a href="qlock.html#Type-enum">Type</a> t ) </h3> Locks the semaphore with a lock of type <em>t</em>. Locks can either be Read or Write. If a lock is Read, attempts to lock by other processes as Read will succeed, Write attempts will block until the lock is unlocked. If locked as Write, all attempts to lock by other processes will block until the lock is unlocked. Locks are stacked: i.e. a given QLock can be locked multiple times by the same process without blocking, and will only be unlocked after a corresponding number of <a href="#unlock">unlock</a>() calls. <h3 class=fn>bool <a name="locked"></a>QLock::locked () const </h3> Returns TRUE if the lock is currently held by the current process; otherwise returns FALSE. <h3 class=fn>void <a name="unlock"></a>QLock::unlock () </h3> Unlocks the semaphore. If other processes were blocking waiting to <a href="#lock">lock</a>() the semaphore, one of them will wake up and succeed in lock()ing. <!-- eof --> <hr><p> This file is part of the <a href="index.html">Qt toolkit</a>. Copyright © 1995-2001 <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center> <table width=100% cellspacing=0 border=0><tr> <td>Copyright © 2001 <a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a> <td align=right><div align=right>Qt version 3.0.2</div> </table></div></address></body> </html>