Click here to Skip to main content
15,883,901 members
Articles / Desktop Programming / MFC

Multi platform plug-in development made easy!

Rate me:
Please Sign up or sign in to vote.
4.04/5 (25 votes)
7 Mar 20065 min read 100.6K   1.9K   63  
How to use and develop plug-ins for multiple platforms.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>SPL Library: SPL::slcThreadLock class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.6 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div>
<h1>SPL::slcThreadLock Class Reference</h1>Thread safe utility class.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="spl__threadlock_8h-source.html">spl_threadlock.h</a>&gt;</code>
<p>
Collaboration diagram for SPL::slcThreadLock:<p><center><img src="classSPL_1_1slcThreadLock__coll__graph.png" border="0" usemap="#SPL_1_1slcThreadLock__coll__map" alt="Collaboration graph"></center>
<map name="SPL_1_1slcThreadLock__coll__map">
<area href="classSPL_1_1slcMutex.html" shape="rect" coords="22,17,116,161" alt="">
</map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center><a href="classSPL_1_1slcThreadLock-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>SPL_API&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classSPL_1_1slcThreadLock.html#a0">slcThreadLock</a> (<a class="el" href="classSPL_1_1slcMutex.html">slcMutex</a> *a_pMutex, bool a_bLock=false)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Initialisation constructor.  <a href="#a0"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>virtual SPL_API&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classSPL_1_1slcThreadLock.html#a1">~slcThreadLock</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Default destructor.  <a href="#a1"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>virtual void SPL_API&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classSPL_1_1slcThreadLock.html#a2">Lock</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Locks a section - If section is already busy then block and wait until it's ready again.  <a href="#a2"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>virtual long SPL_API&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classSPL_1_1slcThreadLock.html#a3">TryLock</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Locks a section - If section is busy, return without blocking.  <a href="#a3"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>virtual void SPL_API&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classSPL_1_1slcThreadLock.html#a4">Unlock</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Unlocks a section.  <a href="#a4"></a><br><br></td></tr>
<tr><td colspan=2><br><h2>Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="classSPL_1_1slcMutex.html">slcMutex</a> *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classSPL_1_1slcThreadLock.html#r0">m_pMutex</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Pointer to mutex object.  <a href="#r0"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>long&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classSPL_1_1slcThreadLock.html#r1">m_lLockCount</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Internal lock counter.  <a href="#r1"></a><br><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Thread safe utility class. 
<p>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="a0" doxytag="SPL::slcThreadLock::slcThreadLock" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> slcThreadLock::slcThreadLock </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="classSPL_1_1slcMutex.html">slcMutex</a> *&nbsp;</td>
          <td class="mdname" nowrap> <em>a_pMutex</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>bool&nbsp;</td>
          <td class="mdname" nowrap> <em>a_bLock</em> = false</td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Initialisation constructor. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>a_pMutex</em>&nbsp;</td><td>[in] Pointer to a <a class="el" href="classSPL_1_1slcMutex.html">slcMutex</a> object for locking (usually "this"). </td></tr>
    <tr><td valign=top><em>a_bLock</em>&nbsp;</td><td>[in] Flag to lock automatically for implicitly or explicitly usage. </td></tr>
  </table>
</dl>
    </td>
  </tr>
</table>

<p>
Here is the call graph for this function:<p><center><img src="classSPL_1_1slcThreadLock_a0_cgraph.png" border="0" usemap="#classSPL_1_1slcThreadLock_a0_cgraph_map" alt=""></center>
<map name="classSPL_1_1slcThreadLock_a0_cgraph_map">
<area href="classSPL_1_1slcThreadLock.html#a2" shape="rect" coords="285,7,445,33" alt="">
<area href="classSPL_1_1slcMutex.html#a2" shape="rect" coords="494,7,625,33" alt="">
</map>
<a class="anchor" name="a1" doxytag="SPL::slcThreadLock::~slcThreadLock" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> slcThreadLock::~<a class="el" href="classSPL_1_1slcThreadLock.html">slcThreadLock</a> </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [virtual]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Default destructor. 
<p>
<dl compact><dt><b>Remarks:</b></dt><dd>Clears all open (forgotten) locks for deadlock safety. </dd></dl>
    </td>
  </tr>
</table>

<p>
Here is the call graph for this function:<p><center><img src="classSPL_1_1slcThreadLock_a1_cgraph.png" border="0" usemap="#classSPL_1_1slcThreadLock_a1_cgraph_map" alt=""></center>
<map name="classSPL_1_1slcThreadLock_a1_cgraph_map">
<area href="classSPL_1_1slcThreadLock.html#a4" shape="rect" coords="292,7,465,33" alt="">
<area href="classSPL_1_1slcMutex.html#a4" shape="rect" coords="514,7,656,33" alt="">
</map>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="a2" doxytag="SPL::slcThreadLock::Lock" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void slcThreadLock::Lock </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [virtual]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Locks a section - If section is already busy then block and wait until it's ready again. 
<p>
    </td>
  </tr>
</table>

<p>
Here is the call graph for this function:<p><center><img src="classSPL_1_1slcThreadLock_a2_cgraph.png" border="0" usemap="#classSPL_1_1slcThreadLock_a2_cgraph_map" alt=""></center>
<map name="classSPL_1_1slcThreadLock_a2_cgraph_map">
<area href="classSPL_1_1slcMutex.html#a2" shape="rect" coords="228,7,359,33" alt="">
</map>
<a class="anchor" name="a3" doxytag="SPL::slcThreadLock::TryLock" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> long slcThreadLock::TryLock </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [virtual]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Locks a section - If section is busy, return without blocking. 
<p>
<dl compact><dt><b>Returns:</b></dt><dd>The method returns one of the following values: </dd></dl>
<dl compact><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign=top><em>EBUSY</em>&nbsp;</td><td>| Section is still locked from another caller. </td></tr>
    <tr><td valign=top><em>0</em>&nbsp;</td><td>| Section is now locked by current call. </td></tr>
  </table>
</dl>
    </td>
  </tr>
</table>

<p>
Here is the call graph for this function:<p><center><img src="classSPL_1_1slcThreadLock_a3_cgraph.png" border="0" usemap="#classSPL_1_1slcThreadLock_a3_cgraph_map" alt=""></center>
<map name="classSPL_1_1slcThreadLock_a3_cgraph_map">
<area href="classSPL_1_1slcMutex.html#a3" shape="rect" coords="245,7,392,33" alt="">
</map>
<a class="anchor" name="a4" doxytag="SPL::slcThreadLock::Unlock" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void slcThreadLock::Unlock </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [virtual]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Unlocks a section. 
<p>
    </td>
  </tr>
</table>

<p>
Here is the call graph for this function:<p><center><img src="classSPL_1_1slcThreadLock_a4_cgraph.png" border="0" usemap="#classSPL_1_1slcThreadLock_a4_cgraph_map" alt=""></center>
<map name="classSPL_1_1slcThreadLock_a4_cgraph_map">
<area href="classSPL_1_1slcMutex.html#a4" shape="rect" coords="240,7,381,33" alt="">
</map>
<hr><h2>Member Data Documentation</h2>
<a class="anchor" name="r1" doxytag="SPL::slcThreadLock::m_lLockCount" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> long <a class="el" href="classSPL_1_1slcThreadLock.html#r1">SPL::slcThreadLock::m_lLockCount</a><code> [private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Internal lock counter. 
<p>
    </td>
  </tr>
</table>
<a class="anchor" name="r0" doxytag="SPL::slcThreadLock::m_pMutex" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="classSPL_1_1slcMutex.html">slcMutex</a>* <a class="el" href="classSPL_1_1slcThreadLock.html#r0">SPL::slcThreadLock::m_pMutex</a><code> [private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Pointer to mutex object. 
<p>
    </td>
  </tr>
</table>
<hr>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="spl__threadlock_8h-source.html">spl_threadlock.h</a><li><a class="el" href="spl__threadlock_8cpp.html">spl_threadlock.cpp</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Sun May 9 15:01:06 2004 for SPL Library by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 > 
</a>1.3.6 </small></address>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Germany Germany
I was born in 1982 near Stuttgart / Germany and began my first steps in programming computers at the age of only nine years on an old Commodore CBM 7072. In 2002 I finished my education as IT specialist for software engineering and did my civillian service afterwards. Currently I'm working as leader of the software division in a bigger company located in south west Germany, mainly on software development and research projects for multimedia terminals and user recognition/verification systems.

Comments and Discussions