<!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">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.3.1"/>
<title>cds: cds::lock::scoped_lock&lt; Lock &gt; Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">cds
   &#160;<span id="projectnumber">1.4.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.3.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Data&#160;Fields</span></a></li>
    </ul>
  </div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespacecds.html">cds</a></li><li class="navelem"><a class="el" href="namespacecds_1_1lock.html">lock</a></li><li class="navelem"><a class="el" href="classcds_1_1lock_1_1scoped__lock.html">scoped_lock</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a>  </div>
  <div class="headertitle">
<div class="title">cds::lock::scoped_lock&lt; Lock &gt; Class Template Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Scoped lock.  
 <a href="classcds_1_1lock_1_1scoped__lock.html#details">More...</a></p>

<p><code>#include &lt;cds/lock/scoped_lock.h&gt;</code></p>
<div class="dynheader">
Inheritance diagram for cds::lock::scoped_lock&lt; Lock &gt;:</div>
<div class="dyncontent">
 <div class="center">
  <img src="classcds_1_1lock_1_1scoped__lock.png" usemap="#cds::lock::scoped_lock&lt; Lock &gt;_map" alt=""/>
  <map id="cds::lock::scoped_lock&lt; Lock &gt;_map" name="cds::lock::scoped_lock&lt; Lock &gt;_map">
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:a262b3a17b2563af4d41d9cd1e16724b3"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a262b3a17b2563af4d41d9cd1e16724b3"></a>
typedef Lock&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcds_1_1lock_1_1scoped__lock.html#a262b3a17b2563af4d41d9cd1e16724b3">lock_type</a></td></tr>
<tr class="memdesc:a262b3a17b2563af4d41d9cd1e16724b3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Lock type. <br/></td></tr>
<tr class="separator:a262b3a17b2563af4d41d9cd1e16724b3"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a2526349dac8f347ee4d4ddb8e627d428"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2526349dac8f347ee4d4ddb8e627d428"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcds_1_1lock_1_1scoped__lock.html#a2526349dac8f347ee4d4ddb8e627d428">scoped_lock</a> (<a class="el" href="classcds_1_1lock_1_1scoped__lock.html#a262b3a17b2563af4d41d9cd1e16724b3">lock_type</a> &amp;l)</td></tr>
<tr class="memdesc:a2526349dac8f347ee4d4ddb8e627d428"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get ownership of lock object <code>l</code> and calls <code>l.lock()</code> <br/></td></tr>
<tr class="separator:a2526349dac8f347ee4d4ddb8e627d428"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3d5cdd55211031e147c424e5199fda13"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcds_1_1lock_1_1scoped__lock.html#a3d5cdd55211031e147c424e5199fda13">scoped_lock</a> (<a class="el" href="classcds_1_1lock_1_1scoped__lock.html#a262b3a17b2563af4d41d9cd1e16724b3">lock_type</a> &amp;l, bool bAlreadyLocked)</td></tr>
<tr class="memdesc:a3d5cdd55211031e147c424e5199fda13"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get ownership of lock object <code>l</code> and conditionally locks it.  <a href="#a3d5cdd55211031e147c424e5199fda13">More...</a><br/></td></tr>
<tr class="separator:a3d5cdd55211031e147c424e5199fda13"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3a137a422e635365345d9eb421d1c1fe"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3a137a422e635365345d9eb421d1c1fe"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcds_1_1lock_1_1scoped__lock.html#a3a137a422e635365345d9eb421d1c1fe">~scoped_lock</a> ()</td></tr>
<tr class="memdesc:a3a137a422e635365345d9eb421d1c1fe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Unlock underlying lock object and release ownership. <br/></td></tr>
<tr class="separator:a3a137a422e635365345d9eb421d1c1fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr class="memitem:afb16557ada7ce1f31d43fdc2bb01b56a"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="afb16557ada7ce1f31d43fdc2bb01b56a"></a>
<a class="el" href="classcds_1_1lock_1_1scoped__lock.html#a262b3a17b2563af4d41d9cd1e16724b3">lock_type</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcds_1_1lock_1_1scoped__lock.html#afb16557ada7ce1f31d43fdc2bb01b56a">m_Lock</a></td></tr>
<tr class="memdesc:afb16557ada7ce1f31d43fdc2bb01b56a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Owned lock object. <br/></td></tr>
<tr class="separator:afb16557ada7ce1f31d43fdc2bb01b56a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><h3>template&lt;class Lock&gt;<br/>
class cds::lock::scoped_lock&lt; Lock &gt;</h3>

<p>Scoped lock. </p>
<p>An object of type <code><a class="el" href="classcds_1_1lock_1_1scoped__lock.html" title="Scoped lock.">scoped_lock</a></code> controls the ownership of a lockable object within a scope. A <code><a class="el" href="classcds_1_1lock_1_1scoped__lock.html" title="Scoped lock.">scoped_lock</a></code> object maintains ownership of a lockable object throughout the <code><a class="el" href="classcds_1_1lock_1_1scoped__lock.html" title="Scoped lock.">scoped_lock</a></code> object’s lifetime. The behavior of a program is undefined if the lockable object does not exist for the entire lifetime of the <code><a class="el" href="classcds_1_1lock_1_1scoped__lock.html" title="Scoped lock.">scoped_lock</a></code> object. The supplied <code>Lock</code> type shall have two methods: <code>lock</code> and <code>unlock</code>.</p>
<p>The constructor locks the wrapped lock object, the destructor unlocks it.</p>
<p>Scoped lock is not copy-constructible and not default-constructible.</p>
<p>This class is similar to <code>std::lock_quard</code> </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a3d5cdd55211031e147c424e5199fda13"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class Lock &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classcds_1_1lock_1_1scoped__lock.html">cds::lock::scoped_lock</a>&lt; Lock &gt;::<a class="el" href="classcds_1_1lock_1_1scoped__lock.html">scoped_lock</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classcds_1_1lock_1_1scoped__lock.html#a262b3a17b2563af4d41d9cd1e16724b3">lock_type</a> &amp;&#160;</td>
          <td class="paramname"><em>l</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>bAlreadyLocked</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get ownership of lock object <code>l</code> and conditionally locks it. </p>
<p>The constructor calls <code>l.lock()</code> only if <code>bAlreadyLocked</code> is <code>false</code>. If <code>bAlreadyLocked</code> is <code>true</code>, no locking is performed.</p>
<p>In any case, the destructor of <code><a class="el" href="classcds_1_1lock_1_1scoped__lock.html" title="Scoped lock.">scoped_lock</a></code> object invokes <code>l.unlock()</code>. </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>cds/lock/scoped_lock.h</li>
</ul>
</div><!-- contents -->
		<hr/>
		<div align="right">
			<b>cds</b> <b>1.4.0</b> 
			Developed by <i>Maxim Khiszinsky aka khizmax</i> 2007 - 2012
			<br/>
			<i>Autogenerated Mon May 20 2013 00:38:01 by Doxygen 1.8.3.1</i>
		</div>
	</BODY>
</HTML>
