1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
3  <head>
4    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5    <meta http-equiv="Content-Style-Type" content="text/css" />
6    <link rel="stylesheet" href="../../../css/manpage.css" type="text/css" />
7    <title>TryInitialize</title>
8  </head>
9  <body>
10    <h1><CODE><a href="../../../nn/Overview.html">nn</a>::<a href="../../../nn/os/Overview.html">os</a>::<a href="../../../nn/os/ManagedThread/Overview.html">ManagedThread</a>::TryInitialize</CODE> Member Function</h1>
11    <h2>Syntax</h2>
12    <div class="section">
13      <pre class="definition">#include &lt;nn/os.h&gt;
14
15template &lt;typename T, typename U, typename Stack&gt;
16<a href="../../../nn/Result/Overview.html">nn::Result</a> TryInitialize(
17     void(*)(T) f,
18     U param,
19     Stack & stack,
20     <a href="../../../nn_types/s32.html">s32</a> priority = PRIORITY_DEFAULT,
21     <a href="../../../nn_types/s32.html">s32</a> coreNo = CORE_NO_DEFAULT
22);
23</pre>
24    </div>
25    <h2>Template Arguments</h2>
26    <div class="section">
27      <table class="arguments">
28        <thead>
29          <tr>
30            <th>Name</th>
31            <td>Description</td>
32          </tr>
33        </thead>
34        <tr>
35          <th>T</th>
36          <td>Data type of argument(s) of the function to run (this type must be copyable).</td>
37        </tr>
38        <tr>
39          <th>U</th>
40          <td>A type that can be converted to <SPAN class="argument">T</SPAN>.</td>
41        </tr>
42        <tr>
43          <th>Stack</th>
44          <td>Type representing stacks.</td>
45        </tr> </table>
46    </div>
47    <h2>Parameters</h2>
48    <div class="section">
49      <table class="arguments">
50        <thead>
51          <tr>
52            <td width="15" />
53            <th>Name</th>
54            <td>Description</td>
55          </tr>
56        </thead>
57        <tr>
58          <td>in</td>
59          <th>f</th>
60          <td>Pointer to the function that will run on the created thread.</td>
61        </tr>
62        <tr>
63          <td>in</td>
64          <th>param</th>
65          <td>Parameter to pass for the <SPAN class="argument">f</SPAN> argument.</td>
66        </tr>
67        <tr>
68          <td>in</td>
69          <th>stack</th>
70          <td>Object representing the stack region.</td>
71        </tr>
72        <tr>
73          <td>in</td>
74          <th>priority</th>
75          <td>Priority of the thread being created.</td>
76        </tr>
77        <tr>
78          <td>in</td>
79          <th>coreNo</th>
80          <td>Preferred processor for the thread being created.</td>
81        </tr> </table>
82    </div>
83    <h2>Return Values</h2>
84    <div class="section">Returns the function's execution result. </div>
85    <h2>Description</h2>
86    <div class="section">
87      <p>Specifies a buffer for the stack and creates a thread.</p><p>
88                Uses the buffer specified by the user for a stack and creates a thread. To actually begin the processing of the thread you need to call <CODE><a href="../../../nn/os/ManagedThread/Start.html">Start</a></CODE>.
89            </p><p>
90                <SPAN class="argument">param</SPAN> is copied to the buffer once the value has been passed as the stack, and then passed from there as the <SPAN class="argument">f</SPAN> argument.
91            </p><p>
92                The <SPAN class="argument">stack</SPAN> argument must be a class instance that has the <CODE>GetStackBottom</CODE> member function (which returns an <CODE>uptr</CODE> type value as the address of the bottom of the stack) and the <CODE>GetStackSize</CODE> member function (which returns a <CODE>size_t</CODE> type value for the stack size. <CODE><a href="../../../nn/os/StackBuffer/Overview.html">StackBuffer</a></CODE> satisfies these conditions and can be used as the argument.
93            </p><p>
94                You need to call <CODE><a href="../../../nn/os/ManagedThread/InitializeEnvironment.html">InitializeEnvironment</a></CODE> before using <CODE>ManagedThread</CODE>.
95            </p></div>
96    <h2>Revision History</h2>
97    <div class="section">
98      <dl class="history">
99        <dt>2012/04/13</dt>
100        <dd>Initial version.<br />
101        </dd>
102      </dl>
103    </div>
104  <hr><p>CONFIDENTIAL</p></body>
105</html>