Files
Minecraft-Community-Edition/doc/html/classmce_1_1_thread.html
Joud Kandeel ef7efddeef added docs
2026-04-01 20:47:40 +02:00

311 lines
16 KiB
HTML

<!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.16.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Minecraft Community Edition: mce::Thread Class Reference</title>
<link rel="icon" href="logo channel.png" type="image/x-icon" />
<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>
<script type="text/javascript" src="clipboard.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="cookie.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 id="projectrow">
<td id="projectalign">
<div id="projectname">Minecraft Community Edition<span id="projectnumber">&#160;0.1.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.16.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search/",'.html');
</script>
<script type="text/javascript">
$(function() { codefold.init(); });
</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',true);
$(function() { init_search(); });
});
</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">
$(function(){initNavTree('classmce_1_1_thread.html','','classmce_1_1_thread-members'); });
</script>
<div id="container">
<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="headertitle"><div class="title">mce::Thread Class Reference</div></div>
</div><!--header-->
<div class="contents">
<p>Lightweight high-level thread wrapper.
<a href="#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="_thread_8hpp_source.html">Thread.hpp</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 id="header-pub-methods" class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a90e3636f9c64c36a6935a849445b17c1" id="r_a90e3636f9c64c36a6935a849445b17c1"><td class="memTemplParams" colspan="2">template&lt;typename F&gt; </td></tr>
<tr class="memitem:a90e3636f9c64c36a6935a849445b17c1 template"><td class="memItemLeft">&#160;</td><td class="memItemRight"><a class="el" href="#a90e3636f9c64c36a6935a849445b17c1">Thread</a> (<a class="el" href="classmce_1_1_q_event_bus.html">QEventBus</a> &amp;qBus, F function)</td></tr>
<tr class="memdesc:a90e3636f9c64c36a6935a849445b17c1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Construct a <a class="el" href="classmce_1_1_thread.html" title="Lightweight high-level thread wrapper.">Thread</a> from a generic callable (lambda, functor, function pointer). <br /></td></tr>
<tr class="memitem:a35eebc21874cf98c954d0f06f5fa8cb3" id="r_a35eebc21874cf98c954d0f06f5fa8cb3"><td class="memTemplParams" colspan="2">template&lt;typename C&gt; </td></tr>
<tr class="memitem:a35eebc21874cf98c954d0f06f5fa8cb3 template"><td class="memItemLeft">&#160;</td><td class="memItemRight"><a class="el" href="#a35eebc21874cf98c954d0f06f5fa8cb3">Thread</a> (<a class="el" href="classmce_1_1_q_event_bus.html">QEventBus</a> &amp;qBus, void(C::*function)(), C *object)</td></tr>
<tr class="memdesc:a35eebc21874cf98c954d0f06f5fa8cb3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Construct a <a class="el" href="classmce_1_1_thread.html" title="Lightweight high-level thread wrapper.">Thread</a> that will call a parameterless member function. <br /></td></tr>
<tr class="memitem:ad96edc70278355f33805f7826bcea466" id="r_ad96edc70278355f33805f7826bcea466"><td class="memTemplParams" colspan="2">template&lt;typename C, typename... Args&gt; </td></tr>
<tr class="memitem:ad96edc70278355f33805f7826bcea466 template"><td class="memItemLeft">&#160;</td><td class="memItemRight"><a class="el" href="#ad96edc70278355f33805f7826bcea466">Thread</a> (<a class="el" href="classmce_1_1_q_event_bus.html">QEventBus</a> &amp;qBus, void(C::*function)(), C *object, Args &amp;&amp;... args)</td></tr>
<tr class="memdesc:ad96edc70278355f33805f7826bcea466"><td class="mdescLeft">&#160;</td><td class="mdescRight">Construct a <a class="el" href="classmce_1_1_thread.html" title="Lightweight high-level thread wrapper.">Thread</a> that will call a member function with arguments. <br /></td></tr>
<tr class="memitem:ad53fb135e59203bea7469f8ec3bde46b" id="r_ad53fb135e59203bea7469f8ec3bde46b"><td class="memItemLeft"><a id="ad53fb135e59203bea7469f8ec3bde46b" name="ad53fb135e59203bea7469f8ec3bde46b"></a>
&#160;</td><td class="memItemRight"><b>~Thread</b> ()</td></tr>
<tr class="memdesc:ad53fb135e59203bea7469f8ec3bde46b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor; cleans up stored callable and implementation pointer. <br /></td></tr>
<tr class="memitem:a6857a0007eb44e985a11b76e8b2ab81d" id="r_a6857a0007eb44e985a11b76e8b2ab81d"><td class="memItemLeft"><a id="a6857a0007eb44e985a11b76e8b2ab81d" name="a6857a0007eb44e985a11b76e8b2ab81d"></a>
void&#160;</td><td class="memItemRight"><b>launch</b> ()</td></tr>
<tr class="memdesc:a6857a0007eb44e985a11b76e8b2ab81d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Start execution of the stored callable on a new thread. <br /></td></tr>
<tr class="memitem:a7167ced2613ce6e9e3ae0ee942277c87" id="r_a7167ced2613ce6e9e3ae0ee942277c87"><td class="memItemLeft"><a id="a7167ced2613ce6e9e3ae0ee942277c87" name="a7167ced2613ce6e9e3ae0ee942277c87"></a>
void&#160;</td><td class="memItemRight"><b>wait</b> ()</td></tr>
<tr class="memdesc:a7167ced2613ce6e9e3ae0ee942277c87"><td class="mdescLeft">&#160;</td><td class="mdescRight">Block until the thread has finished executing. <br /></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 id="header-friends" class="groupheader"><a id="friends" name="friends"></a>
Friends</h2></td></tr>
<tr class="memitem:ae3c1cdb20d70b22a5c0bf395614eefff" id="r_ae3c1cdb20d70b22a5c0bf395614eefff"><td class="memItemLeft"><a id="ae3c1cdb20d70b22a5c0bf395614eefff" name="ae3c1cdb20d70b22a5c0bf395614eefff"></a>
class&#160;</td><td class="memItemRight"><b>ThreadImpl</b></td></tr>
</table>
<a name="details" id="details"></a><h2 id="header-details" class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Lightweight high-level thread wrapper. </p>
<p>Stores a pointer to a platform-specific implementation (<a class="el" href="classmce_1_1_thread_impl.html" title="Platform-specific thread implementation.">ThreadImpl</a>) and a type-erased callable adapter (<a class="el" href="structmce_1_1_thread_func.html" title="Abstract type-erased callable interface used as a thread entry point.">ThreadFunc</a>) representing the entry point. Use the constructors to create a <a class="el" href="classmce_1_1_thread.html" title="Lightweight high-level thread wrapper.">Thread</a> from lambdas, functors, member functions, or member functions with arguments. </p>
</div><a name="doc-constructors" id="doc-constructors"></a><h2 id="header-doc-constructors" class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a90e3636f9c64c36a6935a849445b17c1" name="a90e3636f9c64c36a6935a849445b17c1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a90e3636f9c64c36a6935a849445b17c1">&#9670;&#160;</a></span>Thread() <span class="overload">[1/3]</span></h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename F&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">mce::Thread::Thread </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classmce_1_1_q_event_bus.html">QEventBus</a> &amp;</td> <td class="paramname"><span class="paramname"><em>qBus</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">F</td> <td class="paramname"><span class="paramname"><em>function</em></span>&#160;)</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel inline">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Construct a <a class="el" href="classmce_1_1_thread.html" title="Lightweight high-level thread wrapper.">Thread</a> from a generic callable (lambda, functor, function pointer). </p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
<table class="tparams">
<tr><td class="paramname">F</td><td>Type of the callable. </td></tr>
</table>
</dd>
</dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">qBus</td><td>Reference to the <a class="el" href="classmce_1_1_q_event_bus.html" title="Thread-safe event bus.">QEventBus</a> used for thread lifecycle events. </td></tr>
<tr><td class="paramname">function</td><td>The callable to execute when the thread runs. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a35eebc21874cf98c954d0f06f5fa8cb3" name="a35eebc21874cf98c954d0f06f5fa8cb3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a35eebc21874cf98c954d0f06f5fa8cb3">&#9670;&#160;</a></span>Thread() <span class="overload">[2/3]</span></h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename C&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">mce::Thread::Thread </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classmce_1_1_q_event_bus.html">QEventBus</a> &amp;</td> <td class="paramname"><span class="paramname"><em>qBus</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void(C::*</td> <td class="paramname"><span class="paramname"><em>function&#160;</em></span>)(), </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">C *</td> <td class="paramname"><span class="paramname"><em>object</em></span>&#160;)</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel inline">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Construct a <a class="el" href="classmce_1_1_thread.html" title="Lightweight high-level thread wrapper.">Thread</a> that will call a parameterless member function. </p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
<table class="tparams">
<tr><td class="paramname">C</td><td>Class type owning the member function. </td></tr>
</table>
</dd>
</dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">qBus</td><td>Reference to the <a class="el" href="classmce_1_1_q_event_bus.html" title="Thread-safe event bus.">QEventBus</a> used for thread lifecycle events. </td></tr>
<tr><td class="paramname">function</td><td>Pointer to the member function to invoke. </td></tr>
<tr><td class="paramname">object</td><td>Pointer to the object instance on which to invoke the member function. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="ad96edc70278355f33805f7826bcea466" name="ad96edc70278355f33805f7826bcea466"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad96edc70278355f33805f7826bcea466">&#9670;&#160;</a></span>Thread() <span class="overload">[3/3]</span></h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename C, typename ... Args&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">mce::Thread::Thread </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classmce_1_1_q_event_bus.html">QEventBus</a> &amp;</td> <td class="paramname"><span class="paramname"><em>qBus</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void(C::*</td> <td class="paramname"><span class="paramname"><em>function&#160;</em></span>)(), </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">C *</td> <td class="paramname"><span class="paramname"><em>object</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">Args &amp;&amp;...</td> <td class="paramname"><span class="paramname"><em>args</em></span>&#160;)</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel inline">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Construct a <a class="el" href="classmce_1_1_thread.html" title="Lightweight high-level thread wrapper.">Thread</a> that will call a member function with arguments. </p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
<table class="tparams">
<tr><td class="paramname">C</td><td>Class type owning the member function. </td></tr>
<tr><td class="paramname">Args</td><td>Types of the arguments to forward when invoking the member function. </td></tr>
</table>
</dd>
</dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">qBus</td><td>Reference to the <a class="el" href="classmce_1_1_q_event_bus.html" title="Thread-safe event bus.">QEventBus</a> used for thread lifecycle events. </td></tr>
<tr><td class="paramname">function</td><td>Pointer to the member function to invoke. </td></tr>
<tr><td class="paramname">object</td><td>Pointer to the object instance on which to invoke the member function. </td></tr>
<tr><td class="paramname">args</td><td>Arguments to forward to the member function when the thread runs. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>Core/<a class="el" href="_thread_8hpp_source.html">Thread.hpp</a></li>
<li>Core/<b>Thread.cpp</b></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="page-nav" class="page-nav-panel">
<div id="page-nav-resize-handle"></div>
<div id="page-nav-tree">
<div id="page-nav-contents">
</div><!-- page-nav-contents -->
</div><!-- page-nav-tree -->
</div><!-- page-nav -->
</div><!-- container -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><b>mce</b></li><li class="navelem"><a href="classmce_1_1_thread.html">Thread</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.16.1 </li>
</ul>
</div>
</body>
</html>