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    <style type="text/css"><!--
8      span.static_style
9      {
10        font-size			: 8pt;
11        color				: white;
12        font-weight			: bold;
13        background			: #44f;
14        border-left			: solid 1px #aaf;
15        border-top			: solid 1px #aaf;
16        border-right		: solid 1px #00c;
17        border-bottom		: solid 1px #00c;
18        padding-left		: 2px;
19        padding-right		: 2px;
20      }
21
22      span.virtual_style
23      {
24        font-size			 : 8pt;
25        color				 : white;
26        font-weight			: bold;
27        background			: #0a0;
28        border-left			: solid 1px #0f0;
29        border-top			: solid 1px #0f0;
30        border-right		: solid 1px #060;
31        border-bottom		: solid 1px #060;
32        padding-left		: 2px;
33        padding-right		: 2px;
34      }
35
36      span.protected_style
37      {
38        font-size			 : 8pt;
39        color				 : white;
40        font-weight			: bold;
41        background			: #444;
42        border-left			: solid 1px #ccc;
43        border-top			: solid 1px #ccc;
44        border-right		: solid 1px #222;
45        border-bottom		: solid 1px #222;
46        padding-left		: 2px;
47        padding-right		: 2px;
48      }
49        --></style>
50<title>nn::os::ManagedThread</title>
51  </head>
52  <body>
53<h1><CODE><a href="../../../nn/Overview.html">nn</a>::<a href="../../../nn/os/Overview.html">os</a>::ManagedThread</CODE> Class</h1>
54    <div class="section">
55<b>Header file: </b>nn/os.h</div>
56<h2>Syntax</h2>
57    <div class="section">
58      <pre class="definition">class ManagedThread : <br />&nbsp;&nbsp;&nbsp;&nbsp;public nn::fnd::IntrusiveLinkedList<ManagedThread>::Item,<br />&nbsp;&nbsp;&nbsp;&nbsp;public <a href="../../../nn/util/NonCopyable/Overview.html">nn::util::NonCopyable< ManagedThread ></a></pre>
59    </div>
60<h2>Description</h2>
61    <div class="section">
62<p>Utility class with additional features to the standard <CODE><a href="../../../nn/os/Thread/Overview.html">Thread</a></CODE> class.</p><p>Threads are handled basically the same way as with the <CODE><a href="../../../nn/os/Thread/Overview.html">Thread</a></CODE> class, so for details see <a href="../../../nn/os/Thread/Overview.html">Thread</a>. The one difference is that the process of creating threads is separated from the process of starting threads. To create threads, use a function like <CODE><a href="../../../nn/os/ManagedThread/Initialize.html">Initialize</a></CODE>. To start the processing of a thread call <CODE><a href="../../../nn/os/ManagedThread/Start.html">Start</a></CODE>.</p><p>Here is a list of the main features added:<br />・ Get information related to stacks.<br /> ・ Maintain names.<br /> ・ Get IDs faster by caching.<br /> ・ Get instance corresponding to current thread.<br /> ・ Enumerate threads.<br /></p><p>A maximum of 32 threads can be created at the same time, and this restriction includes threads created with <CODE><a href="../../../nn/os/ManagedThread/Overview.html">ManagedThread</a></CODE>.</p><p>You need to call <CODE><a href="../../../nn/os/ManagedThread/InitializeEnvironment.html">InitializeEnvironment</a></CODE> before using this class. Calling this function consumes two <CODE><a href="../../../nn/os/ThreadLocalStorage/Overview.html">ThreadLocalStorage</a></CODE> objects.</p><!-- write here --></div>
63    <a name="class" id="class">
64<h2>Classes</h2>
65      <div class="section">
66        <table class="members">
67          <tr>
68            <th>
69<a href="../../../nn/os/ManagedThread/EnumerateCallback/Overview.html">nn::os::ManagedThread::EnumerateCallback</a>
70            </th>
71<td>Interface class for thread enumeration callbacks.</td>
72          </tr> </table>
73      </div>
74    </a> <a name="function" id="function">
75<h2>Member Functions</h2>
76      <div class="section">
77        <table class="members">
78          <tr>
79<th class="category" colspan="3">Constructors/Destructors</th>
80          </tr>
81          <tr>
82            <td width="100">  </td>
83            <th>
84<a href="../../../nn/os/ManagedThread/ManagedThread.html">ManagedThread</a>
85            </th>
86<td>Constructor.</td>
87          </tr>
88          <tr>
89            <td width="100">  </td>
90            <th>
91<a href="../../../nn/os/ManagedThread/~ManagedThread.html">~ManagedThread</a>
92            </th>
93<td>Destructor.</td>
94          </tr>
95          <tr>
96<th class="category" colspan="3">Thread Creation</th>
97          </tr>
98          <tr>
99            <td width="100">  </td>
100            <th>
101<a href="../../../nn/os/ManagedThread/TryInitialize.html">TryInitialize</a>
102            </th>
103<td>Specifies a buffer for the stack and creates a thread.</td>
104          </tr>
105          <tr>
106            <td width="100">  </td>
107            <th>
108<a href="../../../nn/os/ManagedThread/Initialize.html">Initialize</a>
109            </th>
110<td>Specifies a buffer for the stack and creates a thread.</td>
111          </tr>
112          <tr>
113            <td width="100">  </td>
114            <th>
115<a href="../../../nn/os/ManagedThread/TryInitializeUsingAutoStack.html">TryInitializeUsingAutoStack</a>
116            </th>
117<td>Automatically allocates stack and creates thread.</td>
118          </tr>
119          <tr>
120            <td width="100">  </td>
121            <th>
122<a href="../../../nn/os/ManagedThread/InitializeUsingAutoStack.html">InitializeUsingAutoStack</a>
123            </th>
124<td>Automatically allocates stack and creates thread.</td>
125          </tr>
126          <tr>
127<th class="category" colspan="3">Starting Threads</th>
128          </tr>
129          <tr>
130            <td width="100">  </td>
131            <th>
132<a href="../../../nn/os/ManagedThread/Start.html">Start</a>
133            </th>
134<td>Starts the processing of the thread.</td>
135          </tr>
136          <tr>
137<th class="category" colspan="3">Waiting for Termination and Releasing Resources</th>
138          </tr>
139          <tr>
140            <td width="100">  </td>
141            <th>
142<a href="../../../nn/os/ManagedThread/Finalize.html">Finalize</a>
143            </th>
144<td>Deallocates the resources.</td>
145          </tr>
146          <tr>
147            <td width="100">  </td>
148            <th>
149<a href="../../../nn/os/ManagedThread/Join.html">Join</a>
150            </th>
151<td>Waits for a thread to exit.</td>
152          </tr>
153          <tr>
154            <td width="100">  </td>
155            <th>
156<a href="../../../nn/os/ManagedThread/Detach.html">Detach</a>
157            </th>
158<td>Detaches thread so no longer subject to management.</td>
159          </tr>
160          <tr>
161            <td width="100">  </td>
162            <th>
163<a href="../../../nn/os/ManagedThread/IsAlive.html">IsAlive</a>
164            </th>
165<td>Determines whether the thread is still alive and not yet completed.</td>
166          </tr>
167          <tr>
168            <td width="100">  </td>
169            <th>
170<a href="../../../nn/os/ManagedThread/IsValid.html">IsValid</a>
171            </th>
172<td>Determines whether initialized.</td>
173          </tr>
174          <tr>
175<th class="category" colspan="3">Getters/Setters</th>
176          </tr>
177          <tr>
178            <td width="100">  </td>
179            <th>
180<a href="../../../nn/os/ManagedThread/GetId.html">GetId</a>
181            </th>
182<td>Gets the ID that uniquely identifies the thread.</td>
183          </tr>
184          <tr>
185            <td width="100">  </td>
186            <th>
187<a href="../../../nn/os/ManagedThread/GetPriority.html">GetPriority</a>
188            </th>
189<td>Gets thread priority.</td>
190          </tr>
191          <tr>
192            <td width="100">  </td>
193            <th>
194<a href="../../../nn/os/ManagedThread/ChangePriority.html">ChangePriority</a>
195            </th>
196<td>Changes the priority of the current thread.</td>
197          </tr>
198          <tr>
199            <td width="100">  </td>
200            <th>
201<a href="../../../nn/os/ManagedThread/GetIdealProcessor.html">GetIdealProcessor</a>
202            </th>
203<td>Gets the preferred processor number.</td>
204          </tr>
205          <tr>
206            <td width="100">
207<span class="static_style" title="static">S</span> </td>
208            <th>
209<a href="../../../nn/os/ManagedThread/GetCurrentId.html">GetCurrentId</a>
210            </th>
211<td>Gets the ID that uniquely identifies the current thread.</td>
212          </tr>
213          <tr>
214<th class="category" colspan="3">Stack</th>
215          </tr>
216          <tr>
217            <td width="100">  </td>
218            <th>
219<a href="../../../nn/os/ManagedThread/GetStackBufferBegin.html">GetStackBufferBegin</a>
220            </th>
221<td>Gets the starting address of the buffer being used for the stack.</td>
222          </tr>
223          <tr>
224            <td width="100">  </td>
225            <th>
226<a href="../../../nn/os/ManagedThread/GetStackBottom.html">GetStackBottom</a>
227            </th>
228<td>Gets the address of the bottom of the stack.</td>
229          </tr>
230          <tr>
231            <td width="100">  </td>
232            <th>
233<a href="../../../nn/os/ManagedThread/GetStackBufferEnd.html">GetStackBufferEnd</a>
234            </th>
235<td>Gets the ending address of the buffer being used for the stack.</td>
236          </tr>
237          <tr>
238            <td width="100">  </td>
239            <th>
240<a href="../../../nn/os/ManagedThread/GetStackSize.html">GetStackSize</a>
241            </th>
242<td>Gets the size of the stack.</td>
243          </tr>
244          <tr>
245            <td width="100">  </td>
246            <th>
247<a href="../../../nn/os/ManagedThread/GetStackBufferSize.html">GetStackBufferSize</a>
248            </th>
249<td>Gets the size of the buffer being used for the stack.</td>
250          </tr>
251          <tr>
252<th class="category" colspan="3">Name</th>
253          </tr>
254          <tr>
255            <td width="100">  </td>
256            <th>
257<a href="../../../nn/os/ManagedThread/GetName.html">GetName</a>
258            </th>
259<td>Gets the name.</td>
260          </tr>
261          <tr>
262            <td width="100">  </td>
263            <th>
264<a href="../../../nn/os/ManagedThread/SetName.html">SetName</a>
265            </th>
266<td>Sets the name.</td>
267          </tr>
268          <tr>
269<th class="category" colspan="3">Management</th>
270          </tr>
271          <tr>
272            <td width="100">
273<span class="static_style" title="static">S</span>  </td>
274            <th>
275<a href="../../../nn/os/ManagedThread/GetCurrentThread.html">GetCurrentThread</a>
276            </th>
277<td>Gets the pointer to the <CODE><a href="../../../nn/os/ManagedThread/Overview.html">ManagedThread</a></CODE> corresponding to the current thread.</td>
278          </tr>
279          <tr>
280            <td width="100">
281<span class="static_style" title="static">S</span>  </td>
282            <th>
283<a href="../../../nn/os/ManagedThread/FindByStackAddress.html">FindByStackAddress</a>
284            </th>
285<td>Gets the pointer to the <CODE><a href="../../../nn/os/ManagedThread/Overview.html">ManagedThread</a></CODE> from the stack address.</td>
286          </tr>
287          <tr>
288            <td width="100">
289<span class="static_style" title="static">S</span>  </td>
290            <th>
291<a href="../../../nn/os/ManagedThread/FindById.html">FindById</a>
292            </th>
293<td>Gets the pointer to the <CODE><a href="../../../nn/os/ManagedThread/Overview.html">ManagedThread</a></CODE> from the thread ID.</td>
294          </tr>
295          <tr>
296            <td width="100">
297<span class="static_style" title="static">S</span>  </td>
298            <th>
299<a href="../../../nn/os/ManagedThread/Enumerate.html">Enumerate</a>
300            </th>
301<td>Enumerates the initialized <CODE><a href="../../../nn/os/ManagedThread/Overview.html">ManagedThread</a></CODE> instances.</td>
302          </tr>
303          <tr>
304            <td width="100">
305<span class="static_style" title="static">S</span>  </td>
306            <th>
307<a href="../../../nn/os/ManagedThread/GetCurrentManagedCount.html">GetCurrentManagedCount</a>
308            </th>
309<td>Gets the current number of initialized <a href="../../../nn/os/ManagedThread/Overview.html"><CODE>ManagedThread</CODE></a> instances.</td>
310          </tr>
311          <tr>
312            <td width="100">
313<span class="static_style" title="static">S</span>  </td>
314            <th>
315<a href="../../../nn/os/ManagedThread/InitializeEnvironment.html">InitializeEnvironment</a>
316            </th>
317<td>Conducts initialization in order to use <CODE><a href="../../../nn/os/ManagedThread/Overview.html">ManagedThread</a></CODE>.</td>
318          </tr>
319          <tr>
320            <td width="100">
321<span class="static_style" title="static">S</span> </td>
322            <th>
323<a href="../../../nn/os/ManagedThread/IsEnabled.html"><CODE>IsEnabled</CODE></a>
324            </th>
325<td>Determines if <a href="../../../nn/os/ManagedThread/Overview.html"><CODE>ManagedThread</CODE></a> can be used.</td>
326          </tr> </table>
327      </div>
328    </a>
329<h2>Class Hierarchy</h2>
330    <div class="section">
331<p class="hierarchy"><a href="../../../nn/util/NonCopyable/Overview.html">nn::util::NonCopyable</a><br />&nbsp;&nbsp;<span>nn::fnd::IntrusiveLinkedList</span><br />&nbsp;&nbsp;&nbsp;&nbsp;<b>nn::os::ManagedThread</b>
332      </p>
333    </div>
334<h2>Revision History</h2>
335    <div class="section">
336      <dl class="history">
337        <dt>2012/10/01</dt>
338<dd>Added <CODE>IsEnabled</CODE>.<br />
339        </dd>
340        <dt>2012/04/13</dt>
341<dd>Initial version.<br />
342        </dd>
343      </dl>
344    </div>
345  <hr><p>CONFIDENTIAL</p></body>
346</html>