Files
rtabmap/preview/pr-1492/api/latest/classUSemaphore.html
T

354 lines
17 KiB
HTML
Raw Normal View History

<!-- HTML header for doxygen 1.9.8-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>RTAB-Map: USemaphore 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="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.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>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
<link href="custom.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript">window.RTABMAP_DOC_ROOT="";</script>
<script type="text/javascript" src="../versions.js"></script>
<script type="text/javascript" src="version-switcher.js"></script>
<script type="text/javascript" src="doxygen-awesome-darkmode-toggle.js"></script>
<script type="text/javascript">DoxygenAwesomeDarkModeToggle.init();</script>
</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 id="projectrow">
<td id="projectalign">
<div id="projectname">RTAB-Map<span id="projectnumber">&#160;0.23.10</span>
</div>
<div id="projectbrief">Real-Time Appearance-Based Mapping</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.8 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('classUSemaphore.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- 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">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classUSemaphore-members.html">List of all members</a> </div>
<div class="headertitle"><div class="title">USemaphore Class Reference</div></div>
</div><!--header-->
<div class="contents">
<p><code>#include &lt;<a class="el" href="USemaphore_8h_source.html">USemaphore.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ad991738e68e0a2baaec46ab27296cbe6" id="r_ad991738e68e0a2baaec46ab27296cbe6"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUSemaphore.html#ad991738e68e0a2baaec46ab27296cbe6">USemaphore</a> (int initValue=0)</td></tr>
<tr class="separator:ad991738e68e0a2baaec46ab27296cbe6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1128f81a47324e6de3946a7719c24223" id="r_a1128f81a47324e6de3946a7719c24223"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUSemaphore.html#a1128f81a47324e6de3946a7719c24223">acquire</a> (int n=1, int ms=0)</td></tr>
<tr class="separator:a1128f81a47324e6de3946a7719c24223"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a51a925279a04a54aea3583c4399a744b" id="r_a51a925279a04a54aea3583c4399a744b"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUSemaphore.html#a51a925279a04a54aea3583c4399a744b">acquireTry</a> (int n)</td></tr>
<tr class="separator:a51a925279a04a54aea3583c4399a744b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a693b35a08fd5363b14f3a220081814b5" id="r_a693b35a08fd5363b14f3a220081814b5"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUSemaphore.html#a693b35a08fd5363b14f3a220081814b5">release</a> (int n=1)</td></tr>
<tr class="separator:a693b35a08fd5363b14f3a220081814b5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a840fadefd8bc873c8bdf34c90d180a3b" id="r_a840fadefd8bc873c8bdf34c90d180a3b"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classUSemaphore.html#a840fadefd8bc873c8bdf34c90d180a3b">value</a> ()</td></tr>
<tr class="separator:a840fadefd8bc873c8bdf34c90d180a3b"><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>A semaphore class.</p>
<p>On an <a class="el" href="classUSemaphore.html#a1128f81a47324e6de3946a7719c24223">acquire()</a> call, the calling thread is blocked if the <a class="el" href="classUSemaphore.html">USemaphore</a>'s value is &lt;= 0. It is unblocked when <a class="el" href="classUSemaphore.html#a693b35a08fd5363b14f3a220081814b5">release()</a> is called. The function <a class="el" href="classUSemaphore.html#a1128f81a47324e6de3946a7719c24223">acquire()</a> decreases by 1 (default) the semaphore's value and <a class="el" href="classUSemaphore.html#a693b35a08fd5363b14f3a220081814b5">release()</a> increases it by 1 (default).</p>
<p>Example: </p><div class="fragment"><div class="line"><a class="code hl_class" href="classUSemaphore.html">USemaphore</a> s;</div>
<div class="line">s.<a class="code hl_function" href="classUSemaphore.html#a1128f81a47324e6de3946a7719c24223">acquire</a>(); <span class="comment">// Will wait until s.release() is called by another thread.</span></div>
<div class="ttc" id="aclassUSemaphore_html"><div class="ttname"><a href="classUSemaphore.html">USemaphore</a></div><div class="ttdef"><b>Definition</b> <a href="USemaphore_8h_source.html#l00055">USemaphore.h:56</a></div></div>
<div class="ttc" id="aclassUSemaphore_html_a1128f81a47324e6de3946a7719c24223"><div class="ttname"><a href="classUSemaphore.html#a1128f81a47324e6de3946a7719c24223">USemaphore::acquire</a></div><div class="ttdeci">bool acquire(int n=1, int ms=0)</div><div class="ttdef"><b>Definition</b> <a href="USemaphore_8h_source.html#l00108">USemaphore.h:108</a></div></div>
</div><!-- fragment --><dl class="section see"><dt>See also</dt><dd><a class="el" href="classUMutex.html">UMutex</a> </dd></dl>
<p class="definition">Definition at line <a class="el" href="USemaphore_8h_source.html#l00055">55</a> of file <a class="el" href="USemaphore_8h_source.html">USemaphore.h</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="ad991738e68e0a2baaec46ab27296cbe6" name="ad991738e68e0a2baaec46ab27296cbe6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad991738e68e0a2baaec46ab27296cbe6">&#9670;&#160;</a></span>USemaphore()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">USemaphore::USemaphore </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>initValue</em> = <code>0</code></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>The constructor. The semaphore waits on <a class="el" href="classUSemaphore.html#a1128f81a47324e6de3946a7719c24223">acquire()</a> when its value is &lt;= 0. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">n</td><td>number to initialize </td></tr>
</table>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="USemaphore_8h_source.html#l00062">62</a> of file <a class="el" href="USemaphore_8h_source.html">USemaphore.h</a>.</p>
</div>
</div>
<a id="a7eb1d99e17c6993ea1d4a216bb7d1ff8" name="a7eb1d99e17c6993ea1d4a216bb7d1ff8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7eb1d99e17c6993ea1d4a216bb7d1ff8">&#9670;&#160;</a></span>~USemaphore()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual USemaphore::~USemaphore </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="USemaphore_8h_source.html#l00076">76</a> of file <a class="el" href="USemaphore_8h_source.html">USemaphore.h</a>.</p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a1128f81a47324e6de3946a7719c24223" name="a1128f81a47324e6de3946a7719c24223"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1128f81a47324e6de3946a7719c24223">&#9670;&#160;</a></span>acquire()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool USemaphore::acquire </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>n</em> = <code>1</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>ms</em> = <code>0</code>&#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>Acquire the semaphore. If semaphore's value is &lt;=0, the calling thread will wait until the count acquired is released. </p><dl class="section see"><dt>See also</dt><dd><a class="el" href="classUSemaphore.html#a693b35a08fd5363b14f3a220081814b5">release()</a> </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">n</td><td>number to acquire </td></tr>
<tr><td class="paramname">t</td><td>time to wait (ms), a value &lt;=0 means infinite </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true on success, false on error/timeout </dd></dl>
<p class="definition">Definition at line <a class="el" href="USemaphore_8h_source.html#l00108">108</a> of file <a class="el" href="USemaphore_8h_source.html">USemaphore.h</a>.</p>
</div>
</div>
<a id="a51a925279a04a54aea3583c4399a744b" name="a51a925279a04a54aea3583c4399a744b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a51a925279a04a54aea3583c4399a744b">&#9670;&#160;</a></span>acquireTry()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int USemaphore::acquireTry </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>n</em></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">
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">n</td><td>the number to acquire. </td></tr>
</table>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="USemaphore_8h_source.html#l00164">164</a> of file <a class="el" href="USemaphore_8h_source.html">USemaphore.h</a>.</p>
</div>
</div>
<a id="a693b35a08fd5363b14f3a220081814b5" name="a693b35a08fd5363b14f3a220081814b5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a693b35a08fd5363b14f3a220081814b5">&#9670;&#160;</a></span>release()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int USemaphore::release </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>n</em> = <code>1</code></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>Release the semaphore, increasing its value by n and signaling waiting threads (which called <a class="el" href="classUSemaphore.html#a1128f81a47324e6de3946a7719c24223">acquire()</a>). </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">n</td><td>the number to release. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on success, ERANGE if the release would push the semaphore over SEM_VALUE_MAX (the count is then left unchanged). The Unix implementation cannot fail and always returns 0. </dd></dl>
<p class="definition">Definition at line <a class="el" href="USemaphore_8h_source.html#l00197">197</a> of file <a class="el" href="USemaphore_8h_source.html">USemaphore.h</a>.</p>
</div>
</div>
<a id="a840fadefd8bc873c8bdf34c90d180a3b" name="a840fadefd8bc873c8bdf34c90d180a3b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a840fadefd8bc873c8bdf34c90d180a3b">&#9670;&#160;</a></span>value()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int USemaphore::value </td>
<td>(</td>
<td class="paramname"></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 the USempahore's value. </p><dl class="section return"><dt>Returns</dt><dd>the semaphore's value </dd></dl>
<p class="definition">Definition at line <a class="el" href="USemaphore_8h_source.html#l00221">221</a> of file <a class="el" href="USemaphore_8h_source.html">USemaphore.h</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>utilite/include/rtabmap/utilite/<a class="el" href="USemaphore_8h_source.html">USemaphore.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="classUSemaphore.html">USemaphore</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8 </li>
</ul>
</div>
</body>
</html>