<!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.10"/>
<title>Crashpad: crashpad::Semaphore Class 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="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</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 id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Crashpad
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.10 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespacecrashpad.html">crashpad</a></li><li class="navelem"><a class="el" href="classcrashpad_1_1Semaphore.html">Semaphore</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classcrashpad_1_1Semaphore-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">crashpad::Semaphore Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>An anonymous in-process counting sempahore.  
 <a href="classcrashpad_1_1Semaphore.html#details">More...</a></p>

<p><code>#include &quot;util/synchronization/semaphore.h&quot;</code></p>
<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:affe042d8a25991c90213370af5453010"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1Semaphore.html#affe042d8a25991c90213370af5453010">Semaphore</a> (int value)</td></tr>
<tr class="memdesc:affe042d8a25991c90213370af5453010"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes the semaphore.  <a href="#affe042d8a25991c90213370af5453010">More...</a><br /></td></tr>
<tr class="separator:affe042d8a25991c90213370af5453010"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ade6db63246c9d6f3a36f3631b04c2bfd"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1Semaphore.html#ade6db63246c9d6f3a36f3631b04c2bfd">Wait</a> ()</td></tr>
<tr class="memdesc:ade6db63246c9d6f3a36f3631b04c2bfd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs the wait (or “procure”) operation on the semaphore.  <a href="#ade6db63246c9d6f3a36f3631b04c2bfd">More...</a><br /></td></tr>
<tr class="separator:ade6db63246c9d6f3a36f3631b04c2bfd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af22faf8672a7d7a6dd96aefc53560712"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1Semaphore.html#af22faf8672a7d7a6dd96aefc53560712">TimedWait</a> (double seconds)</td></tr>
<tr class="memdesc:af22faf8672a7d7a6dd96aefc53560712"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs a timed wait (or “procure”) operation on the semaphore.  <a href="#af22faf8672a7d7a6dd96aefc53560712">More...</a><br /></td></tr>
<tr class="separator:af22faf8672a7d7a6dd96aefc53560712"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2ca2f5c53cd11234dc765d2ec95b6c7a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcrashpad_1_1Semaphore.html#a2ca2f5c53cd11234dc765d2ec95b6c7a">Signal</a> ()</td></tr>
<tr class="memdesc:a2ca2f5c53cd11234dc765d2ec95b6c7a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs the signal (or “post”) operation on the semaphore.  <a href="#a2ca2f5c53cd11234dc765d2ec95b6c7a">More...</a><br /></td></tr>
<tr class="separator:a2ca2f5c53cd11234dc765d2ec95b6c7a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>An anonymous in-process counting sempahore. </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="affe042d8a25991c90213370af5453010"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">crashpad::Semaphore::Semaphore </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>value</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">explicit</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Initializes the semaphore. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">value</td><td>The initial value of the semaphore.</td></tr>
  </table>
  </dd>
</dl>
<p>If the semaphore cannot be created, execution is terminated. </p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a2ca2f5c53cd11234dc765d2ec95b6c7a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void crashpad::Semaphore::Signal </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Performs the signal (or “post”) operation on the semaphore. </p>
<p>Atomically increments the value of the semaphore by 1. If the new value is 0, a caller blocked in <a class="el" href="classcrashpad_1_1Semaphore.html#ade6db63246c9d6f3a36f3631b04c2bfd" title="Performs the wait (or “procure”) operation on the semaphore. ">Wait()</a> will be awakened. </p>

</div>
</div>
<a class="anchor" id="af22faf8672a7d7a6dd96aefc53560712"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool crashpad::Semaphore::TimedWait </td>
          <td>(</td>
          <td class="paramtype">double&#160;</td>
          <td class="paramname"><em>seconds</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Performs a timed wait (or “procure”) operation on the semaphore. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">seconds</td><td>The maximum number of seconds to wait for the operation to complete.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>false</code> if the wait timed out, <code>true</code> otherwise.</dd></dl>
<p>This method is simlar to <a class="el" href="classcrashpad_1_1Semaphore.html#ade6db63246c9d6f3a36f3631b04c2bfd" title="Performs the wait (or “procure”) operation on the semaphore. ">Wait()</a>, except that the amount of time that it blocks is limited. </p>

</div>
</div>
<a class="anchor" id="ade6db63246c9d6f3a36f3631b04c2bfd"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void crashpad::Semaphore::Wait </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Performs the wait (or “procure”) operation on the semaphore. </p>
<p>Atomically decrements the value of the semaphore by 1. If the new value is negative, this function blocks and will not return until the semaphore’s value is incremented to 0 by <a class="el" href="classcrashpad_1_1Semaphore.html#a2ca2f5c53cd11234dc765d2ec95b6c7a" title="Performs the signal (or “post”) operation on the semaphore. ">Signal()</a>.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classcrashpad_1_1Semaphore.html#af22faf8672a7d7a6dd96aefc53560712" title="Performs a timed wait (or “procure”) operation on the semaphore. ">TimedWait()</a> </dd></dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>util/synchronization/semaphore.h</li>
<li>util/synchronization/semaphore_mac.cc</li>
<li>util/synchronization/semaphore_posix.cc</li>
<li>util/synchronization/semaphore_win.cc</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.10
</small></address>
</body>
</html>