mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-23 05:12:39 +02:00
256 lines
38 KiB
HTML
256 lines
38 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.9.8"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>libnx: include/switch/kernel/thread.h Source File</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 id="projectrow">
|
|
<td id="projectalign">
|
|
<div id="projectname">libnx<span id="projectnumber"> v4.9.0</span>
|
|
</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&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&dn=expat.txt MIT */
|
|
$(function() {
|
|
initMenu('',true,false,'search.php','Search');
|
|
$(document).ready(function() { init_search(); });
|
|
});
|
|
/* @license-end */
|
|
</script>
|
|
<div id="main-nav"></div>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
$(document).ready(function() { init_codefold(0); });
|
|
/* @license-end */
|
|
</script>
|
|
<!-- 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 id="nav-path" class="navpath">
|
|
<ul>
|
|
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_42bea3d40f1f1694e41a8f3166c98108.html">switch</a></li><li class="navelem"><a class="el" href="dir_36b4ff30955378a33ed199d75bfba1a9.html">kernel</a></li> </ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div class="header">
|
|
<div class="headertitle"><div class="title">thread.h</div></div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<a href="thread_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="comment">/**</span></div>
|
|
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="comment"> * @file thread.h</span></div>
|
|
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span><span class="comment"> * @brief Multi-threading support</span></div>
|
|
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span><span class="comment"> * @author plutoo</span></div>
|
|
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span><span class="comment"> * @copyright libnx Authors</span></div>
|
|
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span><span class="comment"> */</span></div>
|
|
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span><span class="preprocessor">#pragma once</span></div>
|
|
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span><span class="preprocessor">#include "../types.h"</span></div>
|
|
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span><span class="preprocessor">#include "../arm/thread_context.h"</span></div>
|
|
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span><span class="preprocessor">#include "<a class="code" href="wait_8h.html">wait.h</a>"</span></div>
|
|
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span><span class="comment"></span> </div>
|
|
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span><span class="comment">/// Thread information structure.</span></div>
|
|
<div class="foldopen" id="foldopen00013" data-start="{" data-end="};">
|
|
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"><a class="line" href="structThread.html"> 13</a></span><span class="comment"></span><span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code hl_struct" href="structThread.html">Thread</a> {</div>
|
|
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"><a class="line" href="structThread.html#a68b9cab9abef37893b71336c787ac05f"> 14</a></span> <a class="code hl_typedef" href="types_8h.html#ab6d744c6b5de129f12937e482dc674fb">Handle</a> <a class="code hl_variable" href="structThread.html#a68b9cab9abef37893b71336c787ac05f">handle</a>; <span class="comment">///< Thread handle.</span></div>
|
|
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"><a class="line" href="structThread.html#a517e651d606f86e92518d98bdfd71846"> 15</a></span> <span class="keywordtype">bool</span> <a class="code hl_variable" href="structThread.html#a517e651d606f86e92518d98bdfd71846">owns_stack_mem</a>; <span class="comment">///< Whether the stack memory is automatically allocated.</span></div>
|
|
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"><a class="line" href="structThread.html#adb295e5e7964c105e6eae2e698f4a2b7"> 16</a></span> <span class="keywordtype">void</span>* <a class="code hl_variable" href="structThread.html#adb295e5e7964c105e6eae2e698f4a2b7">stack_mem</a>; <span class="comment">///< Pointer to stack memory.</span></div>
|
|
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"><a class="line" href="structThread.html#aebce2668b5d18cfeb413757b1db7d7c7"> 17</a></span> <span class="keywordtype">void</span>* <a class="code hl_variable" href="structThread.html#aebce2668b5d18cfeb413757b1db7d7c7">stack_mirror</a>; <span class="comment">///< Pointer to stack memory mirror.</span></div>
|
|
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"><a class="line" href="structThread.html#a82427b1fb4f606b4cbbecb22b8fe15e3"> 18</a></span> <span class="keywordtype">size_t</span> <a class="code hl_variable" href="structThread.html#a82427b1fb4f606b4cbbecb22b8fe15e3">stack_sz</a>; <span class="comment">///< Stack size.</span></div>
|
|
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> <span class="keywordtype">void</span>** tls_array;</div>
|
|
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> <span class="keyword">struct </span><a class="code hl_struct" href="structThread.html">Thread</a>* next;</div>
|
|
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> <span class="keyword">struct </span><a class="code hl_struct" href="structThread.html">Thread</a>** prev_next;</div>
|
|
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span>} <a class="code hl_struct" href="structThread.html">Thread</a>;</div>
|
|
</div>
|
|
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span><span class="comment"></span> </div>
|
|
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span><span class="comment">/// Creates a \ref Waiter for a \ref Thread.</span></div>
|
|
<div class="foldopen" id="foldopen00025" data-start="{" data-end="}">
|
|
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"><a class="line" href="thread_8h.html#a2e6e3f29723798d9a913e15f75ad739a"> 25</a></span><span class="comment"></span><span class="keyword">static</span> <span class="keyword">inline</span> <a class="code hl_struct" href="structWaiter.html">Waiter</a> <a class="code hl_function" href="thread_8h.html#a2e6e3f29723798d9a913e15f75ad739a">waiterForThread</a>(<a class="code hl_struct" href="structThread.html">Thread</a>* t)</div>
|
|
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span>{</div>
|
|
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> <span class="keywordflow">return</span> <a class="code hl_function" href="wait_8h.html#aab566c1bfeaeea7a02d4fc20d34a0025">waiterForHandle</a>(t-><a class="code hl_variable" href="structThread.html#a68b9cab9abef37893b71336c787ac05f">handle</a>);</div>
|
|
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span>}</div>
|
|
</div>
|
|
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span><span class="comment"></span> </div>
|
|
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span><span class="comment">/**</span></div>
|
|
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span><span class="comment"> * @brief Creates a thread.</span></div>
|
|
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span><span class="comment"> * @param t Thread information structure which will be filled in.</span></div>
|
|
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span><span class="comment"> * @param entry Entrypoint of the thread.</span></div>
|
|
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span><span class="comment"> * @param arg Argument to pass to the entrypoint.</span></div>
|
|
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span><span class="comment"> * @param stack_mem Memory to use as backing for stack/tls/reent. Must be page-aligned. NULL argument means to allocate new memory.</span></div>
|
|
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span><span class="comment"> * @param stack_sz If stack_mem is NULL, size to use for stack. If stack_mem is non-NULL, size to use for stack + reent + tls (must be page-aligned).</span></div>
|
|
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span><span class="comment"> * @param prio Thread priority (0x00~0x3F); 0x2C is the usual priority of the main thread, 0x3B is a special priority on cores 0..2 that enables preemptive multithreading (0x3F on core 3).</span></div>
|
|
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span><span class="comment"> * @param cpuid ID of the core on which to create the thread (0~3); or -2 to use the default core for the current process.</span></div>
|
|
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span><span class="comment"> * @return Result code.</span></div>
|
|
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span><span class="comment"> */</span></div>
|
|
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"><a class="line" href="thread_8h.html#a1e364a2e5a676593ee47b4dd394bae37"> 41</a></span><a class="code hl_typedef" href="types_8h.html#ad1be2721625a17f1be47fac918032afe">Result</a> <a class="code hl_function" href="thread_8h.html#a1e364a2e5a676593ee47b4dd394bae37">threadCreate</a>(</div>
|
|
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> <a class="code hl_struct" href="structThread.html">Thread</a>* t, <a class="code hl_typedef" href="types_8h.html#a857e4e893f41191500e83c00058df64e">ThreadFunc</a> entry, <span class="keywordtype">void</span>* arg, <span class="keywordtype">void</span> *<a class="code hl_variable" href="structThread.html#adb295e5e7964c105e6eae2e698f4a2b7">stack_mem</a>, <span class="keywordtype">size_t</span> <a class="code hl_variable" href="structThread.html#a82427b1fb4f606b4cbbecb22b8fe15e3">stack_sz</a>,</div>
|
|
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> <span class="keywordtype">int</span> prio, <span class="keywordtype">int</span> cpuid);</div>
|
|
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span><span class="comment"></span> </div>
|
|
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span><span class="comment">/**</span></div>
|
|
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span><span class="comment"> * @brief Starts the execution of a thread.</span></div>
|
|
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span><span class="comment"> * @param t Thread information structure.</span></div>
|
|
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span><span class="comment"> * @return Result code.</span></div>
|
|
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span><span class="comment"> */</span></div>
|
|
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"><a class="line" href="thread_8h.html#a281fc7ada387987bb234e8c720623c70"> 50</a></span><a class="code hl_typedef" href="types_8h.html#ad1be2721625a17f1be47fac918032afe">Result</a> <a class="code hl_function" href="thread_8h.html#a281fc7ada387987bb234e8c720623c70">threadStart</a>(<a class="code hl_struct" href="structThread.html">Thread</a>* t);</div>
|
|
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span><span class="comment"></span> </div>
|
|
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span><span class="comment">/**</span></div>
|
|
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span><span class="comment"> * @brief Exits the current thread immediately.</span></div>
|
|
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span><span class="comment"> */</span></div>
|
|
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"><a class="line" href="thread_8h.html#a2bf2e2199de56b7b481fc56bbb5e0596"> 55</a></span><span class="keywordtype">void</span> <a class="code hl_define" href="types_8h.html#ade5bb7679c90297209347fcb85a0db41">NX_NORETURN</a> <a class="code hl_function" href="thread_8h.html#a2bf2e2199de56b7b481fc56bbb5e0596">threadExit</a>(<span class="keywordtype">void</span>);</div>
|
|
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span><span class="comment"></span> </div>
|
|
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span><span class="comment">/**</span></div>
|
|
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span><span class="comment"> * @brief Waits for a thread to finish executing.</span></div>
|
|
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span><span class="comment"> * @param t Thread information structure.</span></div>
|
|
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span><span class="comment"> * @return Result code.</span></div>
|
|
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span><span class="comment"> */</span></div>
|
|
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"><a class="line" href="thread_8h.html#abf3971a364d3b4acc51a9acab8fb48ca"> 62</a></span><a class="code hl_typedef" href="types_8h.html#ad1be2721625a17f1be47fac918032afe">Result</a> <a class="code hl_function" href="thread_8h.html#abf3971a364d3b4acc51a9acab8fb48ca">threadWaitForExit</a>(<a class="code hl_struct" href="structThread.html">Thread</a>* t);</div>
|
|
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span><span class="comment"></span> </div>
|
|
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span><span class="comment">/**</span></div>
|
|
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span><span class="comment"> * @brief Frees up resources associated with a thread.</span></div>
|
|
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span><span class="comment"> * @param t Thread information structure.</span></div>
|
|
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span><span class="comment"> * @return Result code.</span></div>
|
|
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span><span class="comment"> */</span></div>
|
|
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"><a class="line" href="thread_8h.html#a164dae120ea7ccfb6046a1bddebb67ee"> 69</a></span><a class="code hl_typedef" href="types_8h.html#ad1be2721625a17f1be47fac918032afe">Result</a> <a class="code hl_function" href="thread_8h.html#a164dae120ea7ccfb6046a1bddebb67ee">threadClose</a>(<a class="code hl_struct" href="structThread.html">Thread</a>* t);</div>
|
|
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span><span class="comment"></span> </div>
|
|
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span><span class="comment">/**</span></div>
|
|
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span><span class="comment"> * @brief Pauses the execution of a thread.</span></div>
|
|
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span><span class="comment"> * @param t Thread information structure.</span></div>
|
|
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span><span class="comment"> * @return Result code.</span></div>
|
|
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span><span class="comment"> */</span></div>
|
|
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"><a class="line" href="thread_8h.html#a641f84744cafc196900726d7fe05c535"> 76</a></span><a class="code hl_typedef" href="types_8h.html#ad1be2721625a17f1be47fac918032afe">Result</a> <a class="code hl_function" href="thread_8h.html#a641f84744cafc196900726d7fe05c535">threadPause</a>(<a class="code hl_struct" href="structThread.html">Thread</a>* t);</div>
|
|
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span><span class="comment"></span> </div>
|
|
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span><span class="comment">/**</span></div>
|
|
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span><span class="comment"> * @brief Resumes the execution of a thread, after having been paused.</span></div>
|
|
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span><span class="comment"> * @param t Thread information structure.</span></div>
|
|
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span><span class="comment"> * @return Result code.</span></div>
|
|
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span><span class="comment"> */</span></div>
|
|
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"><a class="line" href="thread_8h.html#a39a3b6584e8926f9ebea9bb7cb4383e3"> 83</a></span><a class="code hl_typedef" href="types_8h.html#ad1be2721625a17f1be47fac918032afe">Result</a> <a class="code hl_function" href="thread_8h.html#a39a3b6584e8926f9ebea9bb7cb4383e3">threadResume</a>(<a class="code hl_struct" href="structThread.html">Thread</a>* t);</div>
|
|
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span><span class="comment"></span> </div>
|
|
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span><span class="comment">/**</span></div>
|
|
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span><span class="comment"> * @brief Dumps the registers of a thread paused by @ref threadPause (register groups: all).</span></div>
|
|
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span><span class="comment"> * @param[out] ctx Output thread context (register dump).</span></div>
|
|
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span><span class="comment"> * @param t Thread information structure.</span></div>
|
|
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span><span class="comment"> * @return Result code.</span></div>
|
|
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span><span class="comment"> * @warning Official kernel will not dump x0..x18 if the thread is currently executing a system call, and prior to 6.0.0 doesn't dump TPIDR_EL0.</span></div>
|
|
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span><span class="comment"> */</span></div>
|
|
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"><a class="line" href="thread_8h.html#a62ab4a6b389d55dfcbd3e5888c956477"> 92</a></span><a class="code hl_typedef" href="types_8h.html#ad1be2721625a17f1be47fac918032afe">Result</a> <a class="code hl_function" href="thread_8h.html#a62ab4a6b389d55dfcbd3e5888c956477">threadDumpContext</a>(<a class="code hl_struct" href="structThreadContext.html">ThreadContext</a>* ctx, <a class="code hl_struct" href="structThread.html">Thread</a>* t);</div>
|
|
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span><span class="comment"></span> </div>
|
|
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span><span class="comment">/**</span></div>
|
|
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span><span class="comment"> * @brief Gets a pointer to the current thread structure.</span></div>
|
|
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span><span class="comment"> * @return Thread information structure.</span></div>
|
|
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span><span class="comment"> */</span></div>
|
|
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"><a class="line" href="thread_8h.html#a9bd639e8dce00938edad775ac2a265e0"> 98</a></span><a class="code hl_struct" href="structThread.html">Thread</a> *<a class="code hl_function" href="thread_8h.html#a9bd639e8dce00938edad775ac2a265e0">threadGetSelf</a>(<span class="keywordtype">void</span>);</div>
|
|
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span><span class="comment"></span> </div>
|
|
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span><span class="comment">/**</span></div>
|
|
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span><span class="comment"> * @brief Gets the raw handle to the current thread.</span></div>
|
|
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span><span class="comment"> * @return The current thread's handle.</span></div>
|
|
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span><span class="comment"> */</span></div>
|
|
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"><a class="line" href="thread_8h.html#ab1e73de2d30787392ce4c6e5e95863ec"> 104</a></span><a class="code hl_typedef" href="types_8h.html#ab6d744c6b5de129f12937e482dc674fb">Handle</a> <a class="code hl_function" href="thread_8h.html#ab1e73de2d30787392ce4c6e5e95863ec">threadGetCurHandle</a>(<span class="keywordtype">void</span>);</div>
|
|
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span><span class="comment"></span> </div>
|
|
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span><span class="comment">/**</span></div>
|
|
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span><span class="comment"> * @brief Allocates a TLS slot.</span></div>
|
|
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span><span class="comment"> * @param destructor Function to run automatically when a thread exits.</span></div>
|
|
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span><span class="comment"> * @return TLS slot ID on success, or a negative value on failure.</span></div>
|
|
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span><span class="comment"> */</span></div>
|
|
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"><a class="line" href="thread_8h.html#a4f9356f6c1ca991a5aac1ee3f4a48fb6"> 111</a></span><a class="code hl_typedef" href="types_8h.html#ae9b1af5c037e57a98884758875d3a7c4">s32</a> <a class="code hl_function" href="thread_8h.html#a4f9356f6c1ca991a5aac1ee3f4a48fb6">threadTlsAlloc</a>(<span class="keywordtype">void</span> (* destructor)(<span class="keywordtype">void</span>*));</div>
|
|
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span><span class="comment"></span> </div>
|
|
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span><span class="comment">/**</span></div>
|
|
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span><span class="comment"> * @brief Retrieves the value stored in a TLS slot.</span></div>
|
|
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span><span class="comment"> * @param slot_id TLS slot ID.</span></div>
|
|
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span><span class="comment"> * @return Value.</span></div>
|
|
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span><span class="comment"> */</span></div>
|
|
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"><a class="line" href="thread_8h.html#aef4eb92dd60d717dd4ab7a4f9dc5ff50"> 118</a></span><span class="keywordtype">void</span>* <a class="code hl_function" href="thread_8h.html#aef4eb92dd60d717dd4ab7a4f9dc5ff50">threadTlsGet</a>(<a class="code hl_typedef" href="types_8h.html#ae9b1af5c037e57a98884758875d3a7c4">s32</a> slot_id);</div>
|
|
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span><span class="comment"></span> </div>
|
|
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span><span class="comment">/**</span></div>
|
|
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span><span class="comment"> * @brief Stores the specified value into a TLS slot.</span></div>
|
|
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span><span class="comment"> * @param slot_id TLS slot ID.</span></div>
|
|
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span><span class="comment"> * @param value Value.</span></div>
|
|
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span><span class="comment"> */</span></div>
|
|
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"><a class="line" href="thread_8h.html#a3d3610073ab88b78191d779a421386b2"> 125</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="thread_8h.html#a3d3610073ab88b78191d779a421386b2">threadTlsSet</a>(<a class="code hl_typedef" href="types_8h.html#ae9b1af5c037e57a98884758875d3a7c4">s32</a> slot_id, <span class="keywordtype">void</span>* value);</div>
|
|
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span><span class="comment"></span> </div>
|
|
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span><span class="comment">/**</span></div>
|
|
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span><span class="comment"> * @brief Frees a TLS slot.</span></div>
|
|
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span><span class="comment"> * @param slot_id TLS slot ID.</span></div>
|
|
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span><span class="comment"> */</span></div>
|
|
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"><a class="line" href="thread_8h.html#a4d9bfdfcf558827a48a5e5057e145f19"> 131</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="thread_8h.html#a4d9bfdfcf558827a48a5e5057e145f19">threadTlsFree</a>(<a class="code hl_typedef" href="types_8h.html#ae9b1af5c037e57a98884758875d3a7c4">s32</a> slot_id);</div>
|
|
<div class="ttc" id="astructThreadContext_html"><div class="ttname"><a href="structThreadContext.html">ThreadContext</a></div><div class="ttdoc">Thread context structure (register dump)</div><div class="ttdef"><b>Definition</b> thread_context.h:49</div></div>
|
|
<div class="ttc" id="astructThread_html"><div class="ttname"><a href="structThread.html">Thread</a></div><div class="ttdoc">Thread information structure.</div><div class="ttdef"><b>Definition</b> thread.h:13</div></div>
|
|
<div class="ttc" id="astructThread_html_a517e651d606f86e92518d98bdfd71846"><div class="ttname"><a href="structThread.html#a517e651d606f86e92518d98bdfd71846">Thread::owns_stack_mem</a></div><div class="ttdeci">bool owns_stack_mem</div><div class="ttdoc">Whether the stack memory is automatically allocated.</div><div class="ttdef"><b>Definition</b> thread.h:15</div></div>
|
|
<div class="ttc" id="astructThread_html_a68b9cab9abef37893b71336c787ac05f"><div class="ttname"><a href="structThread.html#a68b9cab9abef37893b71336c787ac05f">Thread::handle</a></div><div class="ttdeci">Handle handle</div><div class="ttdoc">Thread handle.</div><div class="ttdef"><b>Definition</b> thread.h:14</div></div>
|
|
<div class="ttc" id="astructThread_html_a82427b1fb4f606b4cbbecb22b8fe15e3"><div class="ttname"><a href="structThread.html#a82427b1fb4f606b4cbbecb22b8fe15e3">Thread::stack_sz</a></div><div class="ttdeci">size_t stack_sz</div><div class="ttdoc">Stack size.</div><div class="ttdef"><b>Definition</b> thread.h:18</div></div>
|
|
<div class="ttc" id="astructThread_html_adb295e5e7964c105e6eae2e698f4a2b7"><div class="ttname"><a href="structThread.html#adb295e5e7964c105e6eae2e698f4a2b7">Thread::stack_mem</a></div><div class="ttdeci">void * stack_mem</div><div class="ttdoc">Pointer to stack memory.</div><div class="ttdef"><b>Definition</b> thread.h:16</div></div>
|
|
<div class="ttc" id="astructThread_html_aebce2668b5d18cfeb413757b1db7d7c7"><div class="ttname"><a href="structThread.html#aebce2668b5d18cfeb413757b1db7d7c7">Thread::stack_mirror</a></div><div class="ttdeci">void * stack_mirror</div><div class="ttdoc">Pointer to stack memory mirror.</div><div class="ttdef"><b>Definition</b> thread.h:17</div></div>
|
|
<div class="ttc" id="astructWaiter_html"><div class="ttname"><a href="structWaiter.html">Waiter</a></div><div class="ttdoc">Waiter structure, representing any generic waitable synchronization object; both kernel-mode and user...</div><div class="ttdef"><b>Definition</b> wait.h:36</div></div>
|
|
<div class="ttc" id="athread_8h_html_a164dae120ea7ccfb6046a1bddebb67ee"><div class="ttname"><a href="thread_8h.html#a164dae120ea7ccfb6046a1bddebb67ee">threadClose</a></div><div class="ttdeci">Result threadClose(Thread *t)</div><div class="ttdoc">Frees up resources associated with a thread.</div></div>
|
|
<div class="ttc" id="athread_8h_html_a1e364a2e5a676593ee47b4dd394bae37"><div class="ttname"><a href="thread_8h.html#a1e364a2e5a676593ee47b4dd394bae37">threadCreate</a></div><div class="ttdeci">Result threadCreate(Thread *t, ThreadFunc entry, void *arg, void *stack_mem, size_t stack_sz, int prio, int cpuid)</div><div class="ttdoc">Creates a thread.</div></div>
|
|
<div class="ttc" id="athread_8h_html_a281fc7ada387987bb234e8c720623c70"><div class="ttname"><a href="thread_8h.html#a281fc7ada387987bb234e8c720623c70">threadStart</a></div><div class="ttdeci">Result threadStart(Thread *t)</div><div class="ttdoc">Starts the execution of a thread.</div></div>
|
|
<div class="ttc" id="athread_8h_html_a2bf2e2199de56b7b481fc56bbb5e0596"><div class="ttname"><a href="thread_8h.html#a2bf2e2199de56b7b481fc56bbb5e0596">threadExit</a></div><div class="ttdeci">void threadExit(void)</div><div class="ttdoc">Exits the current thread immediately.</div></div>
|
|
<div class="ttc" id="athread_8h_html_a2e6e3f29723798d9a913e15f75ad739a"><div class="ttname"><a href="thread_8h.html#a2e6e3f29723798d9a913e15f75ad739a">waiterForThread</a></div><div class="ttdeci">static Waiter waiterForThread(Thread *t)</div><div class="ttdoc">Creates a Waiter for a Thread.</div><div class="ttdef"><b>Definition</b> thread.h:25</div></div>
|
|
<div class="ttc" id="athread_8h_html_a39a3b6584e8926f9ebea9bb7cb4383e3"><div class="ttname"><a href="thread_8h.html#a39a3b6584e8926f9ebea9bb7cb4383e3">threadResume</a></div><div class="ttdeci">Result threadResume(Thread *t)</div><div class="ttdoc">Resumes the execution of a thread, after having been paused.</div></div>
|
|
<div class="ttc" id="athread_8h_html_a3d3610073ab88b78191d779a421386b2"><div class="ttname"><a href="thread_8h.html#a3d3610073ab88b78191d779a421386b2">threadTlsSet</a></div><div class="ttdeci">void threadTlsSet(s32 slot_id, void *value)</div><div class="ttdoc">Stores the specified value into a TLS slot.</div></div>
|
|
<div class="ttc" id="athread_8h_html_a4d9bfdfcf558827a48a5e5057e145f19"><div class="ttname"><a href="thread_8h.html#a4d9bfdfcf558827a48a5e5057e145f19">threadTlsFree</a></div><div class="ttdeci">void threadTlsFree(s32 slot_id)</div><div class="ttdoc">Frees a TLS slot.</div></div>
|
|
<div class="ttc" id="athread_8h_html_a4f9356f6c1ca991a5aac1ee3f4a48fb6"><div class="ttname"><a href="thread_8h.html#a4f9356f6c1ca991a5aac1ee3f4a48fb6">threadTlsAlloc</a></div><div class="ttdeci">s32 threadTlsAlloc(void(*destructor)(void *))</div><div class="ttdoc">Allocates a TLS slot.</div></div>
|
|
<div class="ttc" id="athread_8h_html_a62ab4a6b389d55dfcbd3e5888c956477"><div class="ttname"><a href="thread_8h.html#a62ab4a6b389d55dfcbd3e5888c956477">threadDumpContext</a></div><div class="ttdeci">Result threadDumpContext(ThreadContext *ctx, Thread *t)</div><div class="ttdoc">Dumps the registers of a thread paused by threadPause (register groups: all).</div></div>
|
|
<div class="ttc" id="athread_8h_html_a641f84744cafc196900726d7fe05c535"><div class="ttname"><a href="thread_8h.html#a641f84744cafc196900726d7fe05c535">threadPause</a></div><div class="ttdeci">Result threadPause(Thread *t)</div><div class="ttdoc">Pauses the execution of a thread.</div></div>
|
|
<div class="ttc" id="athread_8h_html_a9bd639e8dce00938edad775ac2a265e0"><div class="ttname"><a href="thread_8h.html#a9bd639e8dce00938edad775ac2a265e0">threadGetSelf</a></div><div class="ttdeci">Thread * threadGetSelf(void)</div><div class="ttdoc">Gets a pointer to the current thread structure.</div></div>
|
|
<div class="ttc" id="athread_8h_html_ab1e73de2d30787392ce4c6e5e95863ec"><div class="ttname"><a href="thread_8h.html#ab1e73de2d30787392ce4c6e5e95863ec">threadGetCurHandle</a></div><div class="ttdeci">Handle threadGetCurHandle(void)</div><div class="ttdoc">Gets the raw handle to the current thread.</div></div>
|
|
<div class="ttc" id="athread_8h_html_abf3971a364d3b4acc51a9acab8fb48ca"><div class="ttname"><a href="thread_8h.html#abf3971a364d3b4acc51a9acab8fb48ca">threadWaitForExit</a></div><div class="ttdeci">Result threadWaitForExit(Thread *t)</div><div class="ttdoc">Waits for a thread to finish executing.</div></div>
|
|
<div class="ttc" id="athread_8h_html_aef4eb92dd60d717dd4ab7a4f9dc5ff50"><div class="ttname"><a href="thread_8h.html#aef4eb92dd60d717dd4ab7a4f9dc5ff50">threadTlsGet</a></div><div class="ttdeci">void * threadTlsGet(s32 slot_id)</div><div class="ttdoc">Retrieves the value stored in a TLS slot.</div></div>
|
|
<div class="ttc" id="atypes_8h_html_a857e4e893f41191500e83c00058df64e"><div class="ttname"><a href="types_8h.html#a857e4e893f41191500e83c00058df64e">ThreadFunc</a></div><div class="ttdeci">void(* ThreadFunc)(void *)</div><div class="ttdoc">Thread entrypoint function.</div><div class="ttdef"><b>Definition</b> types.h:45</div></div>
|
|
<div class="ttc" id="atypes_8h_html_ab6d744c6b5de129f12937e482dc674fb"><div class="ttname"><a href="types_8h.html#ab6d744c6b5de129f12937e482dc674fb">Handle</a></div><div class="ttdeci">u32 Handle</div><div class="ttdoc">Kernel object handle.</div><div class="ttdef"><b>Definition</b> types.h:43</div></div>
|
|
<div class="ttc" id="atypes_8h_html_ad1be2721625a17f1be47fac918032afe"><div class="ttname"><a href="types_8h.html#ad1be2721625a17f1be47fac918032afe">Result</a></div><div class="ttdeci">u32 Result</div><div class="ttdoc">Function error code result type.</div><div class="ttdef"><b>Definition</b> types.h:44</div></div>
|
|
<div class="ttc" id="atypes_8h_html_ade5bb7679c90297209347fcb85a0db41"><div class="ttname"><a href="types_8h.html#ade5bb7679c90297209347fcb85a0db41">NX_NORETURN</a></div><div class="ttdeci">#define NX_NORETURN</div><div class="ttdoc">Marks a function as not returning, for the purposes of compiler optimization.</div><div class="ttdef"><b>Definition</b> types.h:68</div></div>
|
|
<div class="ttc" id="atypes_8h_html_ae9b1af5c037e57a98884758875d3a7c4"><div class="ttname"><a href="types_8h.html#ae9b1af5c037e57a98884758875d3a7c4">s32</a></div><div class="ttdeci">int32_t s32</div><div class="ttdoc">32-bit signed integer.</div><div class="ttdef"><b>Definition</b> types.h:27</div></div>
|
|
<div class="ttc" id="await_8h_html"><div class="ttname"><a href="wait_8h.html">wait.h</a></div><div class="ttdoc">User mode synchronization primitive waiting operations.</div></div>
|
|
<div class="ttc" id="await_8h_html_aab566c1bfeaeea7a02d4fc20d34a0025"><div class="ttname"><a href="wait_8h.html#aab566c1bfeaeea7a02d4fc20d34a0025">waiterForHandle</a></div><div class="ttdeci">static Waiter waiterForHandle(Handle h)</div><div class="ttdoc">Creates a Waiter for a kernel-mode Handle.</div><div class="ttdef"><b>Definition</b> wait.h:46</div></div>
|
|
</div><!-- fragment --></div><!-- contents -->
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
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
|
|
</small></address>
|
|
</body>
|
|
</html>
|