481 lines
29 KiB
HTML
481 lines
29 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">
|
|
<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.9.1"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>libctru: include/3ds/thread.h File 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">libctru
|
|
 <span id="projectnumber">v2.4.1</span>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.9.1 -->
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
var searchBox = new SearchBox("searchBox", "search",false,'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:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
$(function() {
|
|
initMenu('',true,false,'search.php','Search');
|
|
$(document).ready(function() { init_search(); });
|
|
});
|
|
/* @license-end */</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="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_d475325f6a9fe3bfc3a495c72a9e475e.html">3ds</a></li> </ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#define-members">Macros</a> |
|
|
<a href="#typedef-members">Typedefs</a> |
|
|
<a href="#func-members">Functions</a> </div>
|
|
<div class="headertitle">
|
|
<div class="title">thread.h File Reference</div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
|
|
<p>Provides functions to use threads.
|
|
<a href="#details">More...</a></p>
|
|
<div class="textblock"><code>#include <<a class="el" href="types_8h_source.html">3ds/types.h</a>></code><br />
|
|
<code>#include <<a class="el" href="result_8h_source.html">3ds/result.h</a>></code><br />
|
|
<code>#include <<a class="el" href="synchronization_8h_source.html">3ds/synchronization.h</a>></code><br />
|
|
<code>#include <<a class="el" href="svc_8h_source.html">3ds/svc.h</a>></code><br />
|
|
<code>#include <<a class="el" href="errf_8h_source.html">3ds/errf.h</a>></code><br />
|
|
</div>
|
|
<p><a href="thread_8h_source.html">Go to the source code of this file.</a></p>
|
|
<table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
|
|
Macros</h2></td></tr>
|
|
<tr class="memitem:ab40408690d779ababc87bc40b105279b"><td class="memItemLeft" align="right" valign="top"><a id="ab40408690d779ababc87bc40b105279b"></a>
|
|
#define </td><td class="memItemRight" valign="bottom"><a class="el" href="thread_8h.html#ab40408690d779ababc87bc40b105279b">RUN_HANDLER_ON_FAULTING_STACK</a>   ((void*)1)</td></tr>
|
|
<tr class="memdesc:ab40408690d779ababc87bc40b105279b"><td class="mdescLeft"> </td><td class="mdescRight">Makes the exception handler reuse the stack of the faulting thread as-is. <br /></td></tr>
|
|
<tr class="separator:ab40408690d779ababc87bc40b105279b"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a099258b92996e6da2567e3da9b2f1356"><td class="memItemLeft" align="right" valign="top"><a id="a099258b92996e6da2567e3da9b2f1356"></a>
|
|
#define </td><td class="memItemRight" valign="bottom"><a class="el" href="thread_8h.html#a099258b92996e6da2567e3da9b2f1356">WRITE_DATA_TO_HANDLER_STACK</a>   NULL</td></tr>
|
|
<tr class="memdesc:a099258b92996e6da2567e3da9b2f1356"><td class="mdescLeft"> </td><td class="mdescRight">Makes the exception handler push the exception data on its stack. <br /></td></tr>
|
|
<tr class="separator:a099258b92996e6da2567e3da9b2f1356"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a6bdd0577b7b6ba62b9d04602e70ec7f8"><td class="memItemLeft" align="right" valign="top"><a id="a6bdd0577b7b6ba62b9d04602e70ec7f8"></a>
|
|
#define </td><td class="memItemRight" valign="bottom"><a class="el" href="thread_8h.html#a6bdd0577b7b6ba62b9d04602e70ec7f8">WRITE_DATA_TO_FAULTING_STACK</a>   ((<a class="el" href="structERRF__ExceptionData.html">ERRF_ExceptionData</a>*)1)</td></tr>
|
|
<tr class="memdesc:a6bdd0577b7b6ba62b9d04602e70ec7f8"><td class="mdescLeft"> </td><td class="mdescRight">Makes the exception handler push the exception data on the stack of the faulting thread. <br /></td></tr>
|
|
<tr class="separator:a6bdd0577b7b6ba62b9d04602e70ec7f8"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table><table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
|
|
Typedefs</h2></td></tr>
|
|
<tr class="memitem:a32603732d12a56b392a691e42360b035"><td class="memItemLeft" align="right" valign="top"><a id="a32603732d12a56b392a691e42360b035"></a>
|
|
typedef struct Thread_tag * </td><td class="memItemRight" valign="bottom"><a class="el" href="thread_8h.html#a32603732d12a56b392a691e42360b035">Thread</a></td></tr>
|
|
<tr class="memdesc:a32603732d12a56b392a691e42360b035"><td class="mdescLeft"> </td><td class="mdescRight">libctru thread handle type <br /></td></tr>
|
|
<tr class="separator:a32603732d12a56b392a691e42360b035"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a37848b429717564001807d9619349b31"><td class="memItemLeft" align="right" valign="top"><a id="a37848b429717564001807d9619349b31"></a>
|
|
typedef void(* </td><td class="memItemRight" valign="bottom"><a class="el" href="thread_8h.html#a37848b429717564001807d9619349b31">ExceptionHandler</a>) (<a class="el" href="structERRF__ExceptionInfo.html">ERRF_ExceptionInfo</a> *excep, <a class="el" href="structCpuRegisters.html">CpuRegisters</a> *regs)</td></tr>
|
|
<tr class="memdesc:a37848b429717564001807d9619349b31"><td class="mdescLeft"> </td><td class="mdescRight">Exception handler type, necessarily an ARM function that does not return. <br /></td></tr>
|
|
<tr class="separator:a37848b429717564001807d9619349b31"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table><table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
|
|
Functions</h2></td></tr>
|
|
<tr class="memitem:a38c873d8cb02de7f5eca848fe68183ee"><td class="memItemLeft" align="right" valign="top"><a class="el" href="thread_8h.html#a32603732d12a56b392a691e42360b035">Thread</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="thread_8h.html#a38c873d8cb02de7f5eca848fe68183ee">threadCreate</a> (<a class="el" href="types_8h.html#a857e4e893f41191500e83c00058df64e">ThreadFunc</a> entrypoint, void *arg, size_t stack_size, int prio, int core_id, bool detached)</td></tr>
|
|
<tr class="memdesc:a38c873d8cb02de7f5eca848fe68183ee"><td class="mdescLeft"> </td><td class="mdescRight">Creates a new libctru thread. <a href="thread_8h.html#a38c873d8cb02de7f5eca848fe68183ee">More...</a><br /></td></tr>
|
|
<tr class="separator:a38c873d8cb02de7f5eca848fe68183ee"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a6f95b5664998852d05adfe79d2490988"><td class="memItemLeft" align="right" valign="top"><a class="el" href="types_8h.html#ab6d744c6b5de129f12937e482dc674fb">Handle</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="thread_8h.html#a6f95b5664998852d05adfe79d2490988">threadGetHandle</a> (<a class="el" href="thread_8h.html#a32603732d12a56b392a691e42360b035">Thread</a> thread)</td></tr>
|
|
<tr class="memdesc:a6f95b5664998852d05adfe79d2490988"><td class="mdescLeft"> </td><td class="mdescRight">Retrieves the OS thread handle of a libctru thread. <a href="thread_8h.html#a6f95b5664998852d05adfe79d2490988">More...</a><br /></td></tr>
|
|
<tr class="separator:a6f95b5664998852d05adfe79d2490988"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:aece3cff1637deec4b6497bb438dba2e8"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="thread_8h.html#aece3cff1637deec4b6497bb438dba2e8">threadGetExitCode</a> (<a class="el" href="thread_8h.html#a32603732d12a56b392a691e42360b035">Thread</a> thread)</td></tr>
|
|
<tr class="memdesc:aece3cff1637deec4b6497bb438dba2e8"><td class="mdescLeft"> </td><td class="mdescRight">Retrieves the exit code of a finished libctru thread. <a href="thread_8h.html#aece3cff1637deec4b6497bb438dba2e8">More...</a><br /></td></tr>
|
|
<tr class="separator:aece3cff1637deec4b6497bb438dba2e8"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:aed4c2f06cf2ae66583325bd96588fa27"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="thread_8h.html#aed4c2f06cf2ae66583325bd96588fa27">threadFree</a> (<a class="el" href="thread_8h.html#a32603732d12a56b392a691e42360b035">Thread</a> thread)</td></tr>
|
|
<tr class="memdesc:aed4c2f06cf2ae66583325bd96588fa27"><td class="mdescLeft"> </td><td class="mdescRight">Frees a finished libctru thread. <a href="thread_8h.html#aed4c2f06cf2ae66583325bd96588fa27">More...</a><br /></td></tr>
|
|
<tr class="separator:aed4c2f06cf2ae66583325bd96588fa27"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a5d7a5a77d24710c19f866d02594553db"><td class="memItemLeft" align="right" valign="top"><a class="el" href="types_8h.html#ac830bf5a4f2cf8273f61ab99a46cf163">Result</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="thread_8h.html#a5d7a5a77d24710c19f866d02594553db">threadJoin</a> (<a class="el" href="thread_8h.html#a32603732d12a56b392a691e42360b035">Thread</a> thread, <a class="el" href="types_8h.html#a3f7e2bcbb0b4c338f3c4f6c937cd4234">u64</a> timeout_ns)</td></tr>
|
|
<tr class="memdesc:a5d7a5a77d24710c19f866d02594553db"><td class="mdescLeft"> </td><td class="mdescRight">Waits for a libctru thread to finish (or returns immediately if it is already finished). <a href="thread_8h.html#a5d7a5a77d24710c19f866d02594553db">More...</a><br /></td></tr>
|
|
<tr class="separator:a5d7a5a77d24710c19f866d02594553db"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ac20502670ea68159c68d6e153e27e712"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="thread_8h.html#ac20502670ea68159c68d6e153e27e712">threadDetach</a> (<a class="el" href="thread_8h.html#a32603732d12a56b392a691e42360b035">Thread</a> thread)</td></tr>
|
|
<tr class="memdesc:ac20502670ea68159c68d6e153e27e712"><td class="mdescLeft"> </td><td class="mdescRight">Changes a thread's status from attached to detached. <a href="thread_8h.html#ac20502670ea68159c68d6e153e27e712">More...</a><br /></td></tr>
|
|
<tr class="separator:ac20502670ea68159c68d6e153e27e712"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:aaf77fd339bcd06c1aa63aaffa74ba118"><td class="memItemLeft" align="right" valign="top"><a class="el" href="thread_8h.html#a32603732d12a56b392a691e42360b035">Thread</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="thread_8h.html#aaf77fd339bcd06c1aa63aaffa74ba118">threadGetCurrent</a> (void)</td></tr>
|
|
<tr class="memdesc:aaf77fd339bcd06c1aa63aaffa74ba118"><td class="mdescLeft"> </td><td class="mdescRight">Retrieves the libctru thread handle of the current thread. <a href="thread_8h.html#aaf77fd339bcd06c1aa63aaffa74ba118">More...</a><br /></td></tr>
|
|
<tr class="separator:aaf77fd339bcd06c1aa63aaffa74ba118"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:aa018f7fca858955b66821d6faa4e9b47"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="thread_8h.html#aa018f7fca858955b66821d6faa4e9b47">threadExit</a> (int rc) <a class="el" href="rbtree_8h.html#a797a3e1c8507a7c7b4e051d3f1349154">__attribute__</a>((noreturn))</td></tr>
|
|
<tr class="memdesc:aa018f7fca858955b66821d6faa4e9b47"><td class="mdescLeft"> </td><td class="mdescRight">Exits the current libctru thread with an exit code (not usable from the main thread). <a href="thread_8h.html#aa018f7fca858955b66821d6faa4e9b47">More...</a><br /></td></tr>
|
|
<tr class="separator:aa018f7fca858955b66821d6faa4e9b47"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ad102ce4415b0054ec6903a5668e5ffab"><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="thread_8h.html#ad102ce4415b0054ec6903a5668e5ffab">threadOnException</a> (<a class="el" href="thread_8h.html#a37848b429717564001807d9619349b31">ExceptionHandler</a> handler, void *stack_top, <a class="el" href="structERRF__ExceptionData.html">ERRF_ExceptionData</a> *exception_data)</td></tr>
|
|
<tr class="memdesc:ad102ce4415b0054ec6903a5668e5ffab"><td class="mdescLeft"> </td><td class="mdescRight">Sets the exception handler for the current thread. <a href="thread_8h.html#ad102ce4415b0054ec6903a5668e5ffab">More...</a><br /></td></tr>
|
|
<tr class="separator:ad102ce4415b0054ec6903a5668e5ffab"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
|
<div class="textblock"><p>Provides functions to use threads. </p>
|
|
</div><h2 class="groupheader">Function Documentation</h2>
|
|
<a id="a38c873d8cb02de7f5eca848fe68183ee"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a38c873d8cb02de7f5eca848fe68183ee">◆ </a></span>threadCreate()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname"><a class="el" href="thread_8h.html#a32603732d12a56b392a691e42360b035">Thread</a> threadCreate </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="types_8h.html#a857e4e893f41191500e83c00058df64e">ThreadFunc</a> </td>
|
|
<td class="paramname"><em>entrypoint</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">void * </td>
|
|
<td class="paramname"><em>arg</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"><em>stack_size</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">int </td>
|
|
<td class="paramname"><em>prio</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">int </td>
|
|
<td class="paramname"><em>core_id</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">bool </td>
|
|
<td class="paramname"><em>detached</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Creates a new libctru thread. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">entrypoint</td><td>The function that will be called first upon thread creation </td></tr>
|
|
<tr><td class="paramname">arg</td><td>The argument passed to <code>entrypoint</code> </td></tr>
|
|
<tr><td class="paramname">stack_size</td><td>The size of the stack that will be allocated for the thread (will be rounded to a multiple of 8 bytes) </td></tr>
|
|
<tr><td class="paramname">prio</td><td>Low values gives the thread higher priority. For userland apps, this has to be within the range [0x18;0x3F]. The main thread usually has a priority of 0x30, but not always. Use <a class="el" href="svc_8h.html#a609c04e1cde0d5bd6a71acbed3ad7e54" title="Retrieves the priority of a thread.">svcGetThreadPriority()</a> if you need to create a thread with a priority that is explicitly greater or smaller than that of the main thread. </td></tr>
|
|
<tr><td class="paramname">core_id</td><td>The ID of the processor the thread should be ran on. Processor IDs are labeled starting from 0. On Old3DS it must be <2, and on New3DS it must be <4. Pass -1 to execute the thread on all CPUs and -2 to execute the thread on the default CPU (read from the Exheader). </td></tr>
|
|
<tr><td class="paramname">detached</td><td>When set to true, the thread is automatically freed when it finishes. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>The libctru thread handle on success, NULL on failure.</dd></dl>
|
|
<ul>
|
|
<li>Processor #0 is the application core. It is always possible to create a thread on this core.</li>
|
|
<li>Processor #1 is the system core. If APT_SetAppCpuTimeLimit is used, it is possible to create a single thread on this core.</li>
|
|
<li>Processor #2 is New3DS exclusive. Normal applications can create threads on this core if the exheader kernel flags bitmask has 0x2000 set.</li>
|
|
<li>Processor #3 is New3DS exclusive. Normal applications cannot create threads on this core.</li>
|
|
<li>Processes in the BASE memory region can always create threads on processors #2 and #3.</li>
|
|
</ul>
|
|
<dl class="section note"><dt>Note</dt><dd>Default exit code of a thread is 0. </dd></dl>
|
|
<dl class="section warning"><dt>Warning</dt><dd><a class="el" href="svc_8h.html#a2ddb0d1da1ee4e65a5d2408da6239921">svcExitThread</a> should never be called from the thread, use <a class="el" href="thread_8h.html#aa018f7fca858955b66821d6faa4e9b47">threadExit</a> instead. </dd></dl>
|
|
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="threads_2event_2source_2main_8c-example.html#a7">threads/event/source/main.c</a>, and <a class="el" href="threads_2thread-basic_2source_2main_8c-example.html#a7">threads/thread-basic/source/main.c</a>.</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="ac20502670ea68159c68d6e153e27e712"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#ac20502670ea68159c68d6e153e27e712">◆ </a></span>threadDetach()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void threadDetach </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="thread_8h.html#a32603732d12a56b392a691e42360b035">Thread</a> </td>
|
|
<td class="paramname"><em>thread</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Changes a thread's status from attached to detached. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">thread</td><td>libctru thread handle </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="aa018f7fca858955b66821d6faa4e9b47"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#aa018f7fca858955b66821d6faa4e9b47">◆ </a></span>threadExit()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void threadExit </td>
|
|
<td>(</td>
|
|
<td class="paramtype">int </td>
|
|
<td class="paramname"><em>rc</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Exits the current libctru thread with an exit code (not usable from the main thread). </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">rc</td><td>Exit code </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="aed4c2f06cf2ae66583325bd96588fa27"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#aed4c2f06cf2ae66583325bd96588fa27">◆ </a></span>threadFree()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void threadFree </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="thread_8h.html#a32603732d12a56b392a691e42360b035">Thread</a> </td>
|
|
<td class="paramname"><em>thread</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Frees a finished libctru thread. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">thread</td><td>libctru thread handle </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section remark"><dt>Remarks</dt><dd>This function should not be called if the thread is detached, as it is freed automatically when it finishes. </dd></dl>
|
|
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="threads_2thread-basic_2source_2main_8c-example.html#a17">threads/thread-basic/source/main.c</a>.</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="aaf77fd339bcd06c1aa63aaffa74ba118"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#aaf77fd339bcd06c1aa63aaffa74ba118">◆ </a></span>threadGetCurrent()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname"><a class="el" href="thread_8h.html#a32603732d12a56b392a691e42360b035">Thread</a> threadGetCurrent </td>
|
|
<td>(</td>
|
|
<td class="paramtype">void </td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Retrieves the libctru thread handle of the current thread. </p>
|
|
<dl class="section return"><dt>Returns</dt><dd>libctru thread handle of the current thread, or NULL for the main thread </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="aece3cff1637deec4b6497bb438dba2e8"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#aece3cff1637deec4b6497bb438dba2e8">◆ </a></span>threadGetExitCode()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int threadGetExitCode </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="thread_8h.html#a32603732d12a56b392a691e42360b035">Thread</a> </td>
|
|
<td class="paramname"><em>thread</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Retrieves the exit code of a finished libctru thread. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">thread</td><td>libctru thread handle </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>Exit code </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a6f95b5664998852d05adfe79d2490988"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a6f95b5664998852d05adfe79d2490988">◆ </a></span>threadGetHandle()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname"><a class="el" href="types_8h.html#ab6d744c6b5de129f12937e482dc674fb">Handle</a> threadGetHandle </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="thread_8h.html#a32603732d12a56b392a691e42360b035">Thread</a> </td>
|
|
<td class="paramname"><em>thread</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Retrieves the OS thread handle of a libctru thread. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">thread</td><td>libctru thread handle </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>OS thread handle </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a5d7a5a77d24710c19f866d02594553db"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a5d7a5a77d24710c19f866d02594553db">◆ </a></span>threadJoin()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname"><a class="el" href="types_8h.html#ac830bf5a4f2cf8273f61ab99a46cf163">Result</a> threadJoin </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="thread_8h.html#a32603732d12a56b392a691e42360b035">Thread</a> </td>
|
|
<td class="paramname"><em>thread</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype"><a class="el" href="types_8h.html#a3f7e2bcbb0b4c338f3c4f6c937cd4234">u64</a> </td>
|
|
<td class="paramname"><em>timeout_ns</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Waits for a libctru thread to finish (or returns immediately if it is already finished). </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">thread</td><td>libctru thread handle </td></tr>
|
|
<tr><td class="paramname">timeout_ns</td><td>Timeout in nanoseconds. Pass U64_MAX if a timeout isn't desired </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="threads_2event_2source_2main_8c-example.html#a17">threads/event/source/main.c</a>, and <a class="el" href="threads_2thread-basic_2source_2main_8c-example.html#a15">threads/thread-basic/source/main.c</a>.</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="ad102ce4415b0054ec6903a5668e5ffab"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#ad102ce4415b0054ec6903a5668e5ffab">◆ </a></span>threadOnException()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">static void threadOnException </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="thread_8h.html#a37848b429717564001807d9619349b31">ExceptionHandler</a> </td>
|
|
<td class="paramname"><em>handler</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">void * </td>
|
|
<td class="paramname"><em>stack_top</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype"><a class="el" href="structERRF__ExceptionData.html">ERRF_ExceptionData</a> * </td>
|
|
<td class="paramname"><em>exception_data</em> </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> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Sets the exception handler for the current thread. </p>
|
|
<p>Called from the main thread, this sets the default handler. </p><dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">handler</td><td>The exception handler, necessarily an ARM function that does not return </td></tr>
|
|
<tr><td class="paramname">stack_top</td><td>A pointer to the top of the stack that will be used by the handler. See also <a class="el" href="thread_8h.html#ab40408690d779ababc87bc40b105279b">RUN_HANDLER_ON_FAULTING_STACK</a> </td></tr>
|
|
<tr><td class="paramname">exception_data</td><td>A pointer to the buffer that will contain the exception data. See also <a class="el" href="thread_8h.html#a099258b92996e6da2567e3da9b2f1356">WRITE_DATA_TO_HANDLER_STACK</a> and <a class="el" href="thread_8h.html#a6bdd0577b7b6ba62b9d04602e70ec7f8">WRITE_DATA_TO_FAULTING_STACK</a></td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<p>To have CPU exceptions reported through this mechanism, it is normally necessary that UNITINFO is set to a non-zero value when Kernel11 starts, and this mechanism is also controlled by <a class="el" href="svc_8h.html#ada13386ccb8cb809658a9878a9941a8b">svcKernelSetState</a> type 6, see 3dbrew.</p>
|
|
<p>VFP exceptions are always reported this way even if the process is being debugged using the debug SVCs.</p>
|
|
<p>The current thread need not be a libctru thread. </p>
|
|
|
|
</div>
|
|
</div>
|
|
</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.1
|
|
</small></address>
|
|
</body>
|
|
</html>
|