uvw/classuvw_1_1Thread.html
2019-03-21 14:15:29 +01:00

337 lines
20 KiB
HTML

<!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.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>uvw: uvw::Thread 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>
<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">uvw
&#160;<span id="projectnumber">1.15.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></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="namespaceuvw.html">uvw</a></li><li class="navelem"><a class="el" href="classuvw_1_1Thread.html">Thread</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="classuvw_1_1Thread-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">uvw::Thread Class Reference<span class="mlabels"><span class="mlabel">final</span></span></div> </div>
</div><!--header-->
<div class="contents">
<p>The <a class="el" href="classuvw_1_1Thread.html" title="The Thread wrapper. ">Thread</a> wrapper.
<a href="classuvw_1_1Thread.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="thread_8hpp_source.html">thread.hpp</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for uvw::Thread:</div>
<div class="dyncontent">
<div class="center"><img src="classuvw_1_1Thread__inherit__graph.png" border="0" usemap="#uvw_1_1Thread_inherit__map" alt="Inheritance graph"/></div>
<map name="uvw_1_1Thread_inherit__map" id="uvw_1_1Thread_inherit__map">
<area shape="rect" id="node2" href="classuvw_1_1UnderlyingType.html" title="uvw::UnderlyingType\l\&lt; Thread, uv_thread_t \&gt;" alt="" coords="5,5,168,47"/>
</map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<div class="dynheader">
Collaboration diagram for uvw::Thread:</div>
<div class="dyncontent">
<div class="center"><img src="classuvw_1_1Thread__coll__graph.png" border="0" usemap="#uvw_1_1Thread_coll__map" alt="Collaboration graph"/></div>
<map name="uvw_1_1Thread_coll__map" id="uvw_1_1Thread_coll__map">
<area shape="rect" id="node2" href="classuvw_1_1UnderlyingType.html" title="uvw::UnderlyingType\l\&lt; Thread, uv_thread_t \&gt;" alt="" coords="5,5,168,47"/>
</map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<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:aa2d9ff80741e0c724c30b7b2260182b6"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classuvw_1_1Thread.html#aa2d9ff80741e0c724c30b7b2260182b6">run</a> () noexcept</td></tr>
<tr class="memdesc:aa2d9ff80741e0c724c30b7b2260182b6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new thread. <a href="#aa2d9ff80741e0c724c30b7b2260182b6">More...</a><br /></td></tr>
<tr class="separator:aa2d9ff80741e0c724c30b7b2260182b6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af2733e7b2ce1e4503c32f658a5555aa2"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classuvw_1_1Thread.html#af2733e7b2ce1e4503c32f658a5555aa2">run</a> (<a class="el" href="classuvw_1_1Flags.html">Flags</a>&lt; Options &gt; opts, std::size_t stack={}) noexcept</td></tr>
<tr class="memdesc:af2733e7b2ce1e4503c32f658a5555aa2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new thread. <a href="#af2733e7b2ce1e4503c32f658a5555aa2">More...</a><br /></td></tr>
<tr class="separator:af2733e7b2ce1e4503c32f658a5555aa2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a722ed957709dad00e29eb5f405c70de8"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classuvw_1_1Thread.html#a722ed957709dad00e29eb5f405c70de8">join</a> () noexcept</td></tr>
<tr class="memdesc:a722ed957709dad00e29eb5f405c70de8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Joins with a terminated thread. <a href="#a722ed957709dad00e29eb5f405c70de8">More...</a><br /></td></tr>
<tr class="separator:a722ed957709dad00e29eb5f405c70de8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_methods_classuvw_1_1UnderlyingType"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classuvw_1_1UnderlyingType')"><img src="closed.png" alt="-"/>&#160;Public Member Functions inherited from <a class="el" href="classuvw_1_1UnderlyingType.html">uvw::UnderlyingType&lt; Thread, uv_thread_t &gt;</a></td></tr>
<tr class="memitem:aab78fbfffb3c03d78aab515e605ecb18 inherit pub_methods_classuvw_1_1UnderlyingType"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classuvw_1_1Loop.html">Loop</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classuvw_1_1UnderlyingType.html#aab78fbfffb3c03d78aab515e605ecb18">loop</a> () const noexcept</td></tr>
<tr class="memdesc:aab78fbfffb3c03d78aab515e605ecb18 inherit pub_methods_classuvw_1_1UnderlyingType"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the loop from which the resource was originated. <a href="classuvw_1_1UnderlyingType.html#aab78fbfffb3c03d78aab515e605ecb18">More...</a><br /></td></tr>
<tr class="separator:aab78fbfffb3c03d78aab515e605ecb18 inherit pub_methods_classuvw_1_1UnderlyingType"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab2dddf23a571afb113c8b9c5e83f056f inherit pub_methods_classuvw_1_1UnderlyingType"><td class="memItemLeft" align="right" valign="top">const uv_thread_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classuvw_1_1UnderlyingType.html#ab2dddf23a571afb113c8b9c5e83f056f">raw</a> () const noexcept</td></tr>
<tr class="memdesc:ab2dddf23a571afb113c8b9c5e83f056f inherit pub_methods_classuvw_1_1UnderlyingType"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the underlying raw data structure. <a href="classuvw_1_1UnderlyingType.html#ab2dddf23a571afb113c8b9c5e83f056f">More...</a><br /></td></tr>
<tr class="separator:ab2dddf23a571afb113c8b9c5e83f056f inherit pub_methods_classuvw_1_1UnderlyingType"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a78ac17a623e508fa410453f8c17e5970 inherit pub_methods_classuvw_1_1UnderlyingType"><td class="memItemLeft" align="right" valign="top">uv_thread_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classuvw_1_1UnderlyingType.html#a78ac17a623e508fa410453f8c17e5970">raw</a> () noexcept</td></tr>
<tr class="memdesc:a78ac17a623e508fa410453f8c17e5970 inherit pub_methods_classuvw_1_1UnderlyingType"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the underlying raw data structure. <a href="classuvw_1_1UnderlyingType.html#a78ac17a623e508fa410453f8c17e5970">More...</a><br /></td></tr>
<tr class="separator:a78ac17a623e508fa410453f8c17e5970 inherit pub_methods_classuvw_1_1UnderlyingType"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:aef9fde2f8a565f90b9f80dfbfd9e8650"><td class="memItemLeft" align="right" valign="top">static Type&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classuvw_1_1Thread.html#aef9fde2f8a565f90b9f80dfbfd9e8650">self</a> () noexcept</td></tr>
<tr class="memdesc:aef9fde2f8a565f90b9f80dfbfd9e8650"><td class="mdescLeft">&#160;</td><td class="mdescRight">Obtains the identifier of the calling thread. <a href="#aef9fde2f8a565f90b9f80dfbfd9e8650">More...</a><br /></td></tr>
<tr class="separator:aef9fde2f8a565f90b9f80dfbfd9e8650"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5a6d1d004cdb0130f90fbf3f5a83860d"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classuvw_1_1Thread.html#a5a6d1d004cdb0130f90fbf3f5a83860d">equal</a> (const <a class="el" href="classuvw_1_1Thread.html">Thread</a> &amp;tl, const <a class="el" href="classuvw_1_1Thread.html">Thread</a> &amp;tr) noexcept</td></tr>
<tr class="memdesc:a5a6d1d004cdb0130f90fbf3f5a83860d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compares thread by means of their identifiers. <a href="#a5a6d1d004cdb0130f90fbf3f5a83860d">More...</a><br /></td></tr>
<tr class="separator:a5a6d1d004cdb0130f90fbf3f5a83860d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_static_methods_classuvw_1_1UnderlyingType"><td colspan="2" onclick="javascript:toggleInherit('pub_static_methods_classuvw_1_1UnderlyingType')"><img src="closed.png" alt="-"/>&#160;Static Public Member Functions inherited from <a class="el" href="classuvw_1_1UnderlyingType.html">uvw::UnderlyingType&lt; Thread, uv_thread_t &gt;</a></td></tr>
<tr class="memitem:aa711faff7e88895f769f66e8245bda73 inherit pub_static_methods_classuvw_1_1UnderlyingType"><td class="memItemLeft" align="right" valign="top">static std::shared_ptr&lt; <a class="el" href="classuvw_1_1Thread.html">Thread</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classuvw_1_1UnderlyingType.html#aa711faff7e88895f769f66e8245bda73">create</a> (Args &amp;&amp;... args)</td></tr>
<tr class="memdesc:aa711faff7e88895f769f66e8245bda73 inherit pub_static_methods_classuvw_1_1UnderlyingType"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new resource of the given type. <a href="classuvw_1_1UnderlyingType.html#aa711faff7e88895f769f66e8245bda73">More...</a><br /></td></tr>
<tr class="separator:aa711faff7e88895f769f66e8245bda73 inherit pub_static_methods_classuvw_1_1UnderlyingType"><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>The <a class="el" href="classuvw_1_1Thread.html" title="The Thread wrapper. ">Thread</a> wrapper. </p>
<p>To create a <code><a class="el" href="classuvw_1_1Thread.html" title="The Thread wrapper. ">Thread</a></code> through a <code><a class="el" href="classuvw_1_1Loop.html" title="The Loop class. ">Loop</a></code>, arguments follow:</p>
<ul>
<li>A callback invoked to initialize thread execution. The type must be such that it can be assigned to an <code>std::function&lt;void(std::shared_ptr&lt;void&gt;)&gt;</code>.</li>
<li>An optional payload the type of which is <code>std::shared_ptr&lt;void&gt;</code>. </li>
</ul>
<p class="definition">Definition at line <a class="el" href="thread_8hpp_source.html#l00048">48</a> of file <a class="el" href="thread_8hpp_source.html">thread.hpp</a>.</p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="a5a6d1d004cdb0130f90fbf3f5a83860d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5a6d1d004cdb0130f90fbf3f5a83860d">&#9670;&nbsp;</a></span>equal()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static bool uvw::Thread::equal </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classuvw_1_1Thread.html">Thread</a> &amp;&#160;</td>
<td class="paramname"><em>tl</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="classuvw_1_1Thread.html">Thread</a> &amp;&#160;</td>
<td class="paramname"><em>tr</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 class="mlabel">static</span><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Compares thread by means of their identifiers. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">tl</td><td>A valid instance of a thread. </td></tr>
<tr><td class="paramname">tr</td><td>A valid instance of a thread. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>True if the two threads are the same thread, false otherwise. </dd></dl>
<p class="definition">Definition at line <a class="el" href="thread_8hpp_source.html#l00079">79</a> of file <a class="el" href="thread_8hpp_source.html">thread.hpp</a>.</p>
</div>
</div>
<a id="a722ed957709dad00e29eb5f405c70de8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a722ed957709dad00e29eb5f405c70de8">&#9670;&nbsp;</a></span>join()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool uvw::Thread::join </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">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Joins with a terminated thread. </p>
<dl class="section return"><dt>Returns</dt><dd>True in case of success, false otherwise. </dd></dl>
<p class="definition">Definition at line <a class="el" href="thread_8hpp_source.html#l00117">117</a> of file <a class="el" href="thread_8hpp_source.html">thread.hpp</a>.</p>
</div>
</div>
<a id="aa2d9ff80741e0c724c30b7b2260182b6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa2d9ff80741e0c724c30b7b2260182b6">&#9670;&nbsp;</a></span>run() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool uvw::Thread::run </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">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Creates a new thread. </p>
<dl class="section return"><dt>Returns</dt><dd>True in case of success, false otherwise. </dd></dl>
<p class="definition">Definition at line <a class="el" href="thread_8hpp_source.html#l00091">91</a> of file <a class="el" href="thread_8hpp_source.html">thread.hpp</a>.</p>
</div>
</div>
<a id="af2733e7b2ce1e4503c32f658a5555aa2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af2733e7b2ce1e4503c32f658a5555aa2">&#9670;&nbsp;</a></span>run() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool uvw::Thread::run </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classuvw_1_1Flags.html">Flags</a>&lt; Options &gt;&#160;</td>
<td class="paramname"><em>opts</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::size_t&#160;</td>
<td class="paramname"><em>stack</em> = <code>{}</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 class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Creates a new thread. </p>
<p>Available flags are:</p>
<ul>
<li><code>Thread::Options::THREAD_NO_FLAGS</code>: no flags set.</li>
<li><code>Thread::Options::THREAD_HAS_STACK_SIZE</code>: if set, <code>stack</code> specifies a stack size for the new thread. 0 indicates that the default value should be used (it behaves as if the flag was not set). Other values will be rounded up to the nearest page boundary.</li>
</ul>
<dl class="section return"><dt>Returns</dt><dd>True in case of success, false otherwise. </dd></dl>
<p class="definition">Definition at line <a class="el" href="thread_8hpp_source.html#l00108">108</a> of file <a class="el" href="thread_8hpp_source.html">thread.hpp</a>.</p>
</div>
</div>
<a id="aef9fde2f8a565f90b9f80dfbfd9e8650"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aef9fde2f8a565f90b9f80dfbfd9e8650">&#9670;&nbsp;</a></span>self()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static Type uvw::Thread::self </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">static</span><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Obtains the identifier of the calling thread. </p>
<dl class="section return"><dt>Returns</dt><dd>The identifier of the calling thread. </dd></dl>
<p class="definition">Definition at line <a class="el" href="thread_8hpp_source.html#l00069">69</a> of file <a class="el" href="thread_8hpp_source.html">thread.hpp</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>src/uvw/<a class="el" href="thread_8hpp_source.html">thread.hpp</a></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.13
</small></address>
</body>
</html>