summaryrefslogtreecommitdiff
path: root/docs/RTOS2/html/group__CMSIS__RTOS__ThreadMgmt.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/RTOS2/html/group__CMSIS__RTOS__ThreadMgmt.html')
-rw-r--r--docs/RTOS2/html/group__CMSIS__RTOS__ThreadMgmt.html135
1 files changed, 71 insertions, 64 deletions
diff --git a/docs/RTOS2/html/group__CMSIS__RTOS__ThreadMgmt.html b/docs/RTOS2/html/group__CMSIS__RTOS__ThreadMgmt.html
index dba38af..810da53 100644
--- a/docs/RTOS2/html/group__CMSIS__RTOS__ThreadMgmt.html
+++ b/docs/RTOS2/html/group__CMSIS__RTOS__ThreadMgmt.html
@@ -340,7 +340,7 @@ Functions</h2></td></tr>
<li><b>RUNNING:</b> The thread that is currently running is in the <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#ThreadStates">RUNNING</a> state. Only one thread at a time can be in this state.</li>
<li><b>READY:</b> Threads which are ready to run are in the <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#ThreadStates">READY</a> state. Once the <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#ThreadStates">RUNNING</a> thread has terminated, or is <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#ThreadStates">BLOCKED</a>, the next <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#ThreadStates">READY</a> thread with the highest priority becomes the <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#ThreadStates">RUNNING</a> thread.</li>
<li><b>BLOCKED:</b> Threads that are blocked either delayed, waiting for an event to occur or suspended are in the <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#ThreadStates">BLOCKED</a> state.</li>
-<li><b>TERMINATED:</b> When <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#ga2f8ba6dba6e9c065a6e236ffd410d74a">osThreadTerminate</a> is called, threads are <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#ThreadStates">TERMINATED</a> with resources not yet released.</li>
+<li><b>TERMINATED:</b> When <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#ga2f8ba6dba6e9c065a6e236ffd410d74a">osThreadTerminate</a> is called, threads are <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#ThreadStates">TERMINATED</a> with resources not yet released (applies to <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#joinable_threads">joinable threads).</a></li>
<li><b>INACTIVE:</b> Threads that are not created or have been terminated with all resources released are in the <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#ThreadStates">INACTIVE</a> state.</li>
</ul>
<div class="image">
@@ -368,7 +368,7 @@ Thread State and State Transitions</div></div>
<div class="line"><span class="keywordtype">int</span> main (<span class="keywordtype">void</span>) {</div>
<div class="line"> <a class="code" href="group__CMSIS__RTOS__KernelCtrl.html#gae818f6611d25ba3140bede410a52d659">osKernelInitialize</a>();</div>
<div class="line"> ;</div>
-<div class="line"> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga48d68b8666d99d28fa646ee1d2182b8f">osThreadNew</a>(thread1, NULL, NULL); <span class="comment">// Create thread with default settings</span></div>
+<div class="line"> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga48d68b8666d99d28fa646ee1d2182b8f">osThreadNew</a>(thread1, NULL, NULL); <span class="comment">// Create thread with default settings</span></div>
<div class="line"> ;</div>
<div class="line"> <a class="code" href="group__CMSIS__RTOS__KernelCtrl.html#ga9ae2cc00f0d89d7b6a307bba942b5221">osKernelStart</a>(); </div>
<div class="line">}</div>
@@ -381,12 +381,12 @@ Thread State and State Transitions</div></div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="keyword">const</span> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#structosThreadAttr__t">osThreadAttr_t</a> thread1_attr = {</div>
-<div class="line"> .<a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#aacbc9a219f2d6870e9ce89bb93f975c9">stack_size</a> = 1024 <span class="comment">// Create the thread stack with a size of 1024 bytes</span></div>
+<div class="line"> .<a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#aacbc9a219f2d6870e9ce89bb93f975c9">stack_size</a> = 1024 <span class="comment">// Create the thread stack with a size of 1024 bytes</span></div>
<div class="line">};</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main (<span class="keywordtype">void</span>) {</div>
<div class="line"> ; </div>
-<div class="line"> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga48d68b8666d99d28fa646ee1d2182b8f">osThreadNew</a>(thread1, NULL, &amp;thread1_attr); <span class="comment">// Create thread with custom sized stack memory</span></div>
+<div class="line"> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga48d68b8666d99d28fa646ee1d2182b8f">osThreadNew</a>(thread1, NULL, &amp;thread1_attr); <span class="comment">// Create thread with custom sized stack memory</span></div>
<div class="line"> ;</div>
<div class="line">}</div>
</div><!-- fragment --><p><b>Example 3 - Create thread with statically allocated stack</b></p>
@@ -442,20 +442,20 @@ Thread State and State Transitions</div></div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="keyword">const</span> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#structosThreadAttr__t">osThreadAttr_t</a> thread1_attr = {</div>
-<div class="line"> .<a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#a6a5183df4c54c3e28dc8dc704f2487d5">priority</a> = <a class="code" href="cmsis__os2_8h.html#gad4e3e0971b41f2d17584a8c6837342eca914433934143a9ba767e59577c56e6c2">osPriorityHigh</a> <span class="comment">//Set initial thread priority to high </span></div>
+<div class="line"> .<a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#a6a5183df4c54c3e28dc8dc704f2487d5">priority</a> = <a class="code" href="cmsis__os2_8h.html#gad4e3e0971b41f2d17584a8c6837342eca914433934143a9ba767e59577c56e6c2">osPriorityHigh</a> <span class="comment">//Set initial thread priority to high </span></div>
<div class="line">};</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main (<span class="keywordtype">void</span>) {</div>
<div class="line"> ;</div>
-<div class="line"> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga48d68b8666d99d28fa646ee1d2182b8f">osThreadNew</a>(thread1, NULL, &amp;thread1_attr); </div>
+<div class="line"> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga48d68b8666d99d28fa646ee1d2182b8f">osThreadNew</a>(thread1, NULL, &amp;thread1_attr);</div>
<div class="line"> ;</div>
<div class="line">}</div>
</div><!-- fragment --><p><a class="anchor" id="joinable_threads"></a><b>Example 6 - Joinable threads</b></p>
<p>In this example a master thread creates four threads with the <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#ga249499c519f3f8eef5673009ab6cfcbe">osThreadJoinable</a> attribute. These will do some work and return using the <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#gaddaa452dd7610e4096647a566d3556fc">osThreadExit</a> call after finished. <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#ga3fca90fb0679afeb968aa8c3d5874487">osThreadJoin</a> is used to synchronize the thread termination.</p>
-<div class="fragment"><div class="line"><a class="code" href="cmsis__os2_8h.html#a153a4a31b276a9758959580538720a51">__NO_RETURN</a> <span class="keywordtype">void</span> worker (<span class="keywordtype">void</span> *argument) { </div>
-<div class="line"> ; <span class="comment">// work a lot on data[] </span></div>
-<div class="line"> <a class="code" href="group__CMSIS__RTOS__Wait.html#gaf6055a51390ef65b6b6edc28bf47322e">osDelay</a>(1000); </div>
-<div class="line"> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gaddaa452dd7610e4096647a566d3556fc">osThreadExit</a>();</div>
+<div class="fragment"><div class="line"><a class="code" href="cmsis__os2_8h.html#a153a4a31b276a9758959580538720a51">__NO_RETURN</a> <span class="keywordtype">void</span> worker (<span class="keywordtype">void</span> *argument) {</div>
+<div class="line"> ; <span class="comment">// work a lot on data[] </span></div>
+<div class="line"> <a class="code" href="group__CMSIS__RTOS__Wait.html#gaf6055a51390ef65b6b6edc28bf47322e">osDelay</a>(1000U);</div>
+<div class="line"> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gaddaa452dd7610e4096647a566d3556fc">osThreadExit</a>();</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><a class="code" href="cmsis__os2_8h.html#a153a4a31b276a9758959580538720a51">__NO_RETURN</a> <span class="keywordtype">void</span> thread1 (<span class="keywordtype">void</span> *argument) {</div>
@@ -465,11 +465,11 @@ Thread State and State Transitions</div></div>
<div class="line"></div>
<div class="line"> memset(&amp;worker_attr, 0, <span class="keyword">sizeof</span>(worker_attr));</div>
<div class="line"> worker_attr.<a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#a6e93b49cb79c12f768d72580c7731f30">attr_bits</a> = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga249499c519f3f8eef5673009ab6cfcbe">osThreadJoinable</a>;</div>
-<div class="line"> </div>
-<div class="line"> worker_ids[0] = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga48d68b8666d99d28fa646ee1d2182b8f">osThreadNew</a>(worker, &amp;data[0][0], &amp;worker_attr); </div>
-<div class="line"> worker_ids[1] = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga48d68b8666d99d28fa646ee1d2182b8f">osThreadNew</a>(worker, &amp;data[1][0], &amp;worker_attr); </div>
-<div class="line"> worker_ids[2] = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga48d68b8666d99d28fa646ee1d2182b8f">osThreadNew</a>(worker, &amp;data[2][0], &amp;worker_attr); </div>
-<div class="line"> worker_ids[3] = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga48d68b8666d99d28fa646ee1d2182b8f">osThreadNew</a>(worker, &amp;data[3][0], &amp;worker_attr); </div>
+<div class="line"> </div>
+<div class="line"> worker_ids[0] = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga48d68b8666d99d28fa646ee1d2182b8f">osThreadNew</a>(worker, &amp;data[0][0], &amp;worker_attr);</div>
+<div class="line"> worker_ids[1] = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga48d68b8666d99d28fa646ee1d2182b8f">osThreadNew</a>(worker, &amp;data[1][0], &amp;worker_attr);</div>
+<div class="line"> worker_ids[2] = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga48d68b8666d99d28fa646ee1d2182b8f">osThreadNew</a>(worker, &amp;data[2][0], &amp;worker_attr);</div>
+<div class="line"> worker_ids[3] = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga48d68b8666d99d28fa646ee1d2182b8f">osThreadNew</a>(worker, &amp;data[3][0], &amp;worker_attr);</div>
<div class="line"> </div>
<div class="line"> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga3fca90fb0679afeb968aa8c3d5874487">osThreadJoin</a>(worker_ids[0]);</div>
<div class="line"> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga3fca90fb0679afeb968aa8c3d5874487">osThreadJoin</a>(worker_ids[1]);</div>
@@ -540,7 +540,8 @@ memory for stack <p>Pointer to a memory location for the thread stack (64-bit al
stack_size</td>
<td class="fielddoc">
size of stack <p>The size (in bytes) of the stack specified by <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#ad7c9b42355a4c8b9467130ab3fb19e43">stack_mem</a>.</p>
-<p>Default: <span class="XML-Token">0</span> as the default is no memory provided with <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#ad7c9b42355a4c8b9467130ab3fb19e43">stack_mem</a>. </p>
+<p>Default: <span class="XML-Token">0</span> as the default is no memory provided with <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#ad7c9b42355a4c8b9467130ab3fb19e43">stack_mem</a>.</p>
+<p>/** </p>
</td></tr>
<tr><td class="fieldtype">
<a class="anchor" id="a6a5183df4c54c3e28dc8dc704f2487d5"></a><a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#gad4e3e0971b41f2d17584a8c6837342ec">osPriority_t</a></td>
@@ -556,7 +557,8 @@ initial thread priority (default: osPriorityNormal) <p>Specifies the initial thr
tz_module</td>
<td class="fielddoc">
TrustZone module identifier. <p>TrustZone Thread Context Management Identifier to allocate context memory for threads. The RTOS kernel that runs in non-secure state calls the interface functions defined by the header file TZ_context.h. Can safely be set to zero for threads not using secure calls at all. See <a href="../../Core/html/group__context__trustzone__functions.html">TrustZone RTOS Context Management</a>.</p>
-<p>Default: token{0} not thread context specified. </p>
+<p>Default: <span class="XML-Token">0</span> not thread context specified.</p>
+<p>/** </p>
</td></tr>
<tr><td class="fieldtype">
<a class="anchor" id="a66f538babc389986738ec70104e0562b"></a>uint32_t</td>
@@ -650,7 +652,7 @@ reserved (must be 0) <p>Reserved for future use. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><em><a class="anchor" id="ggad3dc89e942e38d9f3af858a0269a820dae9d77830b6866e287417b6e1d983e971"></a>osThreadInactive</em>&#160;</td><td class="fielddoc">
<p>Inactive. </p>
-<p>The thread is created but not actively used, or has been terminated. </p>
+<p>The thread is created but not actively used, or has been terminated (returned for static control block allocation, when memory pools are used <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#ggad3dc89e942e38d9f3af858a0269a820da339313e26613bc12f66a852e2ff8745e">osThreadError</a> is returned as the control block is no longer valid) </p>
</td></tr>
<tr><td class="fieldname"><em><a class="anchor" id="ggad3dc89e942e38d9f3af858a0269a820da59e286915944fe0e4d1ffdb1f2946f14"></a>osThreadReady</em>&#160;</td><td class="fielddoc">
<p>Ready. </p>
@@ -666,11 +668,11 @@ reserved (must be 0) <p>Reserved for future use. </p>
</td></tr>
<tr><td class="fieldname"><em><a class="anchor" id="ggad3dc89e942e38d9f3af858a0269a820dad5b2726c2d0228f4f1a76cf6b630963c"></a>osThreadTerminated</em>&#160;</td><td class="fielddoc">
<p>Terminated. </p>
-<p>The thread is terminated and all its resources are freed. </p>
+<p>The thread is terminated and all its resources are not yet freed (applies to <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#joinable_threads">joinable threads).</a></p>
</td></tr>
<tr><td class="fieldname"><em><a class="anchor" id="ggad3dc89e942e38d9f3af858a0269a820da339313e26613bc12f66a852e2ff8745e"></a>osThreadError</em>&#160;</td><td class="fielddoc">
<p>Error. </p>
-<p>The thread thread has raised an error condition and cannot be scheduled. </p>
+<p>The thread does not exist (has raised an error condition) and cannot be scheduled. </p>
</td></tr>
<tr><td class="fieldname"><em><a class="anchor" id="gad3dc89e942e38d9f3af858a0269a820da8872f7e352370eb11ee772c7dcca6e6c"></a>osThreadReserved</em>&#160;</td><td class="fielddoc">
<p>Prevents enum down-size compiler optimization. </p>
@@ -928,9 +930,9 @@ reserved (must be 0) <p>Reserved for future use. </p>
<p>The function <b>osThreadGetName</b> returns the pointer to the name string of the thread identified by parameter <em>thread_id</em> or <span class="XML-Token">NULL</span> in case of an error.</p>
<dl class="section note"><dt>Note</dt><dd>This function <b>cannot</b> be called from <a class="el" href="theory_of_operation.html#CMSIS_RTOS_ISR_Calls">Interrupt Service Routines</a>.</dd></dl>
<p><b>Code Example</b> </p>
-<div class="fragment"><div class="line"><span class="keywordtype">void</span> ThreadGetName_example (<span class="keywordtype">void</span>) {</div>
-<div class="line"> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gaa6c32fe2a3e0a2e01f212d55b02e51c7">osThreadId_t</a> thread_id = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga8df03548e89fbc56402a5cd584a505da">osThreadGetId</a> ();</div>
-<div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span>* name = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gac3230f3a55a297514b013ebf38f27e0a">osThreadGetName</a> (thread_id);</div>
+<div class="fragment"><div class="line"><span class="keywordtype">void</span> ThreadGetName_example (<span class="keywordtype">void</span>) {</div>
+<div class="line"> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gaa6c32fe2a3e0a2e01f212d55b02e51c7">osThreadId_t</a> thread_id = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga8df03548e89fbc56402a5cd584a505da">osThreadGetId</a>();</div>
+<div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span>* name = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gac3230f3a55a297514b013ebf38f27e0a">osThreadGetName</a>(thread_id);</div>
<div class="line"> <span class="keywordflow">if</span> (name == NULL) {</div>
<div class="line"> <span class="comment">// Failed to get the thread name; not in a thread</span></div>
<div class="line"> }</div>
@@ -955,10 +957,10 @@ reserved (must be 0) <p>Reserved for future use. </p>
<p>The function <b>osThreadGetId</b> returns the thread object ID of the currently running thread or NULL in case of an error.</p>
<dl class="section note"><dt>Note</dt><dd>This function may be called from <a class="el" href="theory_of_operation.html#CMSIS_RTOS_ISR_Calls">Interrupt Service Routines</a>.</dd></dl>
<p><b>Code Example</b> </p>
-<div class="fragment"><div class="line"><span class="keywordtype">void</span> ThreadGetId_example (<span class="keywordtype">void</span>) {</div>
-<div class="line"> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gaa6c32fe2a3e0a2e01f212d55b02e51c7">osThreadId_t</a> id; <span class="comment">// id for the currently running thread</span></div>
+<div class="fragment"><div class="line"><span class="keywordtype">void</span> ThreadGetId_example (<span class="keywordtype">void</span>) {</div>
+<div class="line"> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gaa6c32fe2a3e0a2e01f212d55b02e51c7">osThreadId_t</a> id; <span class="comment">// id for the currently running thread</span></div>
<div class="line"> </div>
-<div class="line"> <span class="keywordtype">id</span> = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga8df03548e89fbc56402a5cd584a505da">osThreadGetId</a> ();</div>
+<div class="line"> <span class="keywordtype">id</span> = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga8df03548e89fbc56402a5cd584a505da">osThreadGetId</a>();</div>
<div class="line"> <span class="keywordflow">if</span> (<span class="keywordtype">id</span> == NULL) {</div>
<div class="line"> <span class="comment">// Failed to get the id</span></div>
<div class="line"> }</div>
@@ -1027,28 +1029,28 @@ reserved (must be 0) <p>Reserved for future use. </p>
<ul>
<li><em>osOK:</em> the priority of the specified thread has been changed successfully.</li>
<li><em>osErrorParameter:</em> <em>thread_id</em> is <span class="XML-Token">NULL</span> or invalid or <em>priority</em> is incorrect.</li>
-<li><em>osErrorResource:</em> thread specified by parameter <em>thread_id</em> is in an invalid thread state.</li>
+<li><em>osErrorResource:</em> the thread is in an invalid state.</li>
<li><em>osErrorISR:</em> the function <b>osThreadSetPriority</b> cannot be called from interrupt service routines.</li>
</ul>
<dl class="section note"><dt>Note</dt><dd>This function <b>cannot</b> be called from <a class="el" href="theory_of_operation.html#CMSIS_RTOS_ISR_Calls">Interrupt Service Routines</a>.</dd></dl>
<p><b>Code Example</b> </p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="cmsis__os2_8h.html">cmsis_os2.h</a>&quot;</span></div>
<div class="line"> </div>
-<div class="line"><span class="keywordtype">void</span> Thread_1 (<span class="keywordtype">void</span> <span class="keyword">const</span> *arg) { <span class="comment">// Thread function</span></div>
-<div class="line"> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gaa6c32fe2a3e0a2e01f212d55b02e51c7">osThreadId_t</a> id; <span class="comment">// id for the currently running thread</span></div>
-<div class="line"> osStatus_t status; <span class="comment">// status of the executed function</span></div>
-<div class="line"> </div>
-<div class="line"> : </div>
-<div class="line"> <span class="keywordtype">id</span> = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga8df03548e89fbc56402a5cd584a505da">osThreadGetId</a> (); <span class="comment">// Obtain ID of current running thread</span></div>
-<div class="line"> </div>
-<div class="line"> status = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga861a420fb2d643115b06622903fb3bfb">osThreadSetPriority</a> (<span class="keywordtype">id</span>, <a class="code" href="cmsis__os2_8h.html#gad4e3e0971b41f2d17584a8c6837342eca193b650117c209b4a203954542bcc3e6">osPriorityBelowNormal</a>); <span class="comment">// Set thread priority</span></div>
-<div class="line"> <span class="keywordflow">if</span> (status == <a class="code" href="cmsis__os2_8h.html#ga6c0dbe6069e4e7f47bb4cd32ae2b813ea9e1c9e2550bb4de8969a935acffc968f">osOK</a>) {</div>
+<div class="line"><span class="keywordtype">void</span> Thread_1 (<span class="keywordtype">void</span> <span class="keyword">const</span> *arg) { <span class="comment">// Thread function</span></div>
+<div class="line"> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gaa6c32fe2a3e0a2e01f212d55b02e51c7">osThreadId_t</a> id; <span class="comment">// id for the currently running thread</span></div>
+<div class="line"> osStatus_t status; <span class="comment">// status of the executed function</span></div>
+<div class="line"> </div>
+<div class="line"> :</div>
+<div class="line"> <span class="keywordtype">id</span> = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga8df03548e89fbc56402a5cd584a505da">osThreadGetId</a>(); <span class="comment">// Obtain ID of current running thread</span></div>
+<div class="line"> </div>
+<div class="line"> status = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga861a420fb2d643115b06622903fb3bfb">osThreadSetPriority</a>(<span class="keywordtype">id</span>, <a class="code" href="cmsis__os2_8h.html#gad4e3e0971b41f2d17584a8c6837342eca193b650117c209b4a203954542bcc3e6">osPriorityBelowNormal</a>); <span class="comment">// Set thread priority</span></div>
+<div class="line"> <span class="keywordflow">if</span> (status == <a class="code" href="cmsis__os2_8h.html#ga6c0dbe6069e4e7f47bb4cd32ae2b813ea9e1c9e2550bb4de8969a935acffc968f">osOK</a>) {</div>
<div class="line"> <span class="comment">// Thread priority changed to BelowNormal</span></div>
<div class="line"> }</div>
<div class="line"> <span class="keywordflow">else</span> {</div>
<div class="line"> <span class="comment">// Failed to set the priority</span></div>
<div class="line"> }</div>
-<div class="line"> : </div>
+<div class="line"> :</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
@@ -1083,12 +1085,12 @@ reserved (must be 0) <p>Reserved for future use. </p>
<p><b>Code Example</b> </p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="cmsis__os2_8h.html">cmsis_os2.h</a>&quot;</span></div>
<div class="line"> </div>
-<div class="line"><span class="keywordtype">void</span> Thread_1 (<span class="keywordtype">void</span> <span class="keyword">const</span> *arg) { <span class="comment">// Thread function</span></div>
-<div class="line"> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gaa6c32fe2a3e0a2e01f212d55b02e51c7">osThreadId_t</a> id; <span class="comment">// id for the currently running thread</span></div>
-<div class="line"> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gad4e3e0971b41f2d17584a8c6837342ec">osPriority_t</a> priority; <span class="comment">// thread priority</span></div>
+<div class="line"><span class="keywordtype">void</span> Thread_1 (<span class="keywordtype">void</span> <span class="keyword">const</span> *arg) { <span class="comment">// Thread function</span></div>
+<div class="line"> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gaa6c32fe2a3e0a2e01f212d55b02e51c7">osThreadId_t</a> id; <span class="comment">// id for the currently running thread</span></div>
+<div class="line"> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gad4e3e0971b41f2d17584a8c6837342ec">osPriority_t</a> priority; <span class="comment">// thread priority</span></div>
<div class="line"> </div>
-<div class="line"> <span class="keywordtype">id</span> = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga8df03548e89fbc56402a5cd584a505da">osThreadGetId</a> (); <span class="comment">// Obtain ID of current running thread</span></div>
-<div class="line"> priority = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga0aeaf349604f456e68e78f9d3b42e44b">osThreadGetPriority</a> (<span class="keywordtype">id</span>); <span class="comment">// Obtain the thread priority</span></div>
+<div class="line"> <span class="keywordtype">id</span> = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga8df03548e89fbc56402a5cd584a505da">osThreadGetId</a>(); <span class="comment">// Obtain ID of current running thread</span></div>
+<div class="line"> priority = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga0aeaf349604f456e68e78f9d3b42e44b">osThreadGetPriority</a>(<span class="keywordtype">id</span>); <span class="comment">// Obtain the thread priority</span></div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
@@ -1120,12 +1122,12 @@ This function <b>has no impact</b> when called when the kernel is locked, see <a
<p><b>Code Example</b> </p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="cmsis__os2_8h.html">cmsis_os2.h</a>&quot;</span></div>
<div class="line"> </div>
-<div class="line"><span class="keywordtype">void</span> Thread_1 (<span class="keywordtype">void</span> <span class="keyword">const</span> *arg) { <span class="comment">// Thread function</span></div>
-<div class="line"> osStatus_t status; <span class="comment">// status of the executed function</span></div>
+<div class="line"><span class="keywordtype">void</span> Thread_1 (<span class="keywordtype">void</span> <span class="keyword">const</span> *arg) { <span class="comment">// Thread function</span></div>
+<div class="line"> osStatus_t status; <span class="comment">// status of the executed function</span></div>
<div class="line"> :</div>
-<div class="line"> <span class="keywordflow">while</span> (1) {</div>
-<div class="line"> status = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gad01c7ec26535b1de6b018bb9466720e2">osThreadYield</a>(); <span class="comment">// </span></div>
-<div class="line"> <span class="keywordflow">if</span> (status != <a class="code" href="cmsis__os2_8h.html#ga6c0dbe6069e4e7f47bb4cd32ae2b813ea9e1c9e2550bb4de8969a935acffc968f">osOK</a>) {</div>
+<div class="line"> <span class="keywordflow">while</span> (1) {</div>
+<div class="line"> status = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gad01c7ec26535b1de6b018bb9466720e2">osThreadYield</a>();</div>
+<div class="line"> <span class="keywordflow">if</span> (status != <a class="code" href="cmsis__os2_8h.html#ga6c0dbe6069e4e7f47bb4cd32ae2b813ea9e1c9e2550bb4de8969a935acffc968f">osOK</a>) {</div>
<div class="line"> <span class="comment">// an error occurred</span></div>
<div class="line"> }</div>
<div class="line"> }</div>
@@ -1159,7 +1161,7 @@ This function <b>has no impact</b> when called when the kernel is locked, see <a
<ul>
<li><em>osOK:</em> the thread has been suspended successfully.</li>
<li><em>osErrorParameter:</em> <em>thread_id</em> is <span class="XML-Token">NULL</span> or invalid.</li>
-<li><em>osErrorResource:</em> thread specified by parameter <em>thread_id</em> is in an invalid thread state.</li>
+<li><em>osErrorResource:</em> the thread is in an invalid state.</li>
<li><em>osErrorISR:</em> the function <b>osThreadSuspend</b> cannot be called from interrupt service routines.</li>
</ul>
<dl class="section note"><dt>Note</dt><dd>This function <b>cannot</b> be called from <a class="el" href="theory_of_operation.html#CMSIS_RTOS_ISR_Calls">Interrupt Service Routines</a>. </dd>
@@ -1195,7 +1197,7 @@ This function <b>must not</b> be called to suspend the running thread when the k
<ul>
<li><em>osOK:</em> the thread has been resumed successfully.</li>
<li><em>osErrorParameter:</em> <em>thread_id</em> is <span class="XML-Token">NULL</span> or invalid.</li>
-<li><em>osErrorResource:</em> thread specified by parameter <em>thread_id</em> is in an invalid thread state.</li>
+<li><em>osErrorResource:</em> the thread is in an invalid state.</li>
<li><em>osErrorISR:</em> the function <b>osThreadResume</b> cannot be called from interrupt service routines.</li>
</ul>
<dl class="section note"><dt>Note</dt><dd>This function <b>cannot</b> be called from <a class="el" href="theory_of_operation.html#CMSIS_RTOS_ISR_Calls">Interrupt Service Routines</a>. </dd>
@@ -1229,7 +1231,7 @@ This function <b>may be</b> called when kernel is locked (<a class="el" href="gr
<ul>
<li><em>osOK:</em> the attribute of the specified thread has been changed to detached successfully.</li>
<li><em>osErrorParameter:</em> <em>thread_id</em> is <span class="XML-Token">NULL</span> or invalid.</li>
-<li><em>osErrorResource:</em> thread specified by parameter <em>thread_id</em> is in an invalid thread state.</li>
+<li><em>osErrorResource:</em> the thread is in an invalid state.</li>
<li><em>osErrorISR:</em> the function <b>osThreadDetach</b> cannot be called from interrupt service routines.</li>
</ul>
<dl class="section note"><dt>Note</dt><dd>This function <b>cannot</b> be called from <a class="el" href="theory_of_operation.html#CMSIS_RTOS_ISR_Calls">Interrupt Service Routines</a>. </dd></dl>
@@ -1261,10 +1263,13 @@ This function <b>may be</b> called when kernel is locked (<a class="el" href="gr
<ul>
<li><em>osOK:</em> if the thread has already been terminated and joined or once the thread has been terminated and the join operations succeeds.</li>
<li><em>osErrorParameter:</em> <em>thread_id</em> is <span class="XML-Token">NULL</span> or invalid.</li>
-<li><em>osErrorResource:</em> parameter <em>thread_id</em> is <span class="XML-Token">NULL</span> or refers to a thread that is not an active thread or the thread is not joinable.</li>
+<li><em>osErrorResource:</em> the thread is in an invalid state (ex: not joinable).</li>
<li><em>osErrorISR:</em> the function <b>osThreadJoin</b> cannot be called from interrupt service routines.</li>
</ul>
-<dl class="section note"><dt>Note</dt><dd>This function <b>cannot</b> be called from <a class="el" href="theory_of_operation.html#CMSIS_RTOS_ISR_Calls">Interrupt Service Routines</a>. </dd></dl>
+<dl class="section note"><dt>Note</dt><dd>This function <b>cannot</b> be called from <a class="el" href="theory_of_operation.html#CMSIS_RTOS_ISR_Calls">Interrupt Service Routines</a>. <br/>
+ </dd>
+<dd>
+Only one thread shall call <b>osThreadJoin</b> to join the target thread. If multiple threads try to join simultaneously with the same thread, the results are undefined. </dd></dl>
</div>
</div>
@@ -1286,7 +1291,7 @@ This function <b>may be</b> called when kernel is locked (<a class="el" href="gr
<p><b>Code</b> <b>Example</b> </p>
<div class="fragment"><div class="line"><a class="code" href="cmsis__os2_8h.html#a153a4a31b276a9758959580538720a51">__NO_RETURN</a> <span class="keywordtype">void</span> worker (<span class="keywordtype">void</span> *argument) {</div>
<div class="line"> <span class="comment">// do something</span></div>
-<div class="line"> <a class="code" href="group__CMSIS__RTOS__Wait.html#gaf6055a51390ef65b6b6edc28bf47322e">osDelay</a>(1000);</div>
+<div class="line"> <a class="code" href="group__CMSIS__RTOS__Wait.html#gaf6055a51390ef65b6b6edc28bf47322e">osDelay</a>(1000U);</div>
<div class="line"> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gaddaa452dd7610e4096647a566d3556fc">osThreadExit</a>();</div>
<div class="line">}</div>
</div><!-- fragment -->
@@ -1317,30 +1322,32 @@ This function <b>may be</b> called when kernel is locked (<a class="el" href="gr
<ul>
<li><em>osOK:</em> the specified thread has been removed from the active thread list successfully.</li>
<li><em>osErrorParameter:</em> <em>thread_id</em> is <span class="XML-Token">NULL</span> or invalid.</li>
-<li><em>osErrorResource:</em> thread specified by parameter <em>thread_id</em> is in an invalid thread state or no other <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#ThreadStates">READY</a> thread exists.</li>
+<li><em>osErrorResource:</em> the thread is in an invalid state or no other <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#ThreadStates">READY</a> thread exists.</li>
<li><em>osErrorISR:</em> the function <b>osThreadTerminate</b> cannot be called from interrupt service routines.</li>
</ul>
<dl class="section note"><dt>Note</dt><dd>This function <b>cannot</b> be called from <a class="el" href="theory_of_operation.html#CMSIS_RTOS_ISR_Calls">Interrupt Service Routines</a>. </dd>
<dd>
-Avoid calling the function with a <em>thread_id</em> that does not exist or has been terminated already.</dd></dl>
+Avoid calling the function with a <em>thread_id</em> that does not exist or has been terminated already. </dd>
+<dd>
+<b>osThreadTerminate</b> destroys non-joinable threads and removes their thread_id from the system. Subsequent access to the thread_id (for example <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#gacc0a98b42f0a5928e12dc91dc76866b9">osThreadGetState</a>) will return an <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#ggad3dc89e942e38d9f3af858a0269a820da339313e26613bc12f66a852e2ff8745e">osThreadError</a>. Joinable threads will not be destroyed and return the status <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#ggad3dc89e942e38d9f3af858a0269a820dad5b2726c2d0228f4f1a76cf6b630963c">osThreadTerminated</a> until they are joined with <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#ga3fca90fb0679afeb968aa8c3d5874487">osThreadJoin</a>.</dd></dl>
<p><b>Code Example</b> </p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="cmsis__os2_8h.html">cmsis_os2.h</a>&quot;</span></div>
<div class="line"> </div>
-<div class="line"><span class="keywordtype">void</span> Thread_1 (<span class="keywordtype">void</span> *arg); <span class="comment">// function prototype for Thread_1</span></div>
+<div class="line"><span class="keywordtype">void</span> Thread_1 (<span class="keywordtype">void</span> *arg); <span class="comment">// function prototype for Thread_1</span></div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> ThreadTerminate_example (<span class="keywordtype">void</span>) {</div>
<div class="line"> osStatus_t status;</div>
<div class="line"> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gaa6c32fe2a3e0a2e01f212d55b02e51c7">osThreadId_t</a> id;</div>
<div class="line"> </div>
-<div class="line"> <span class="keywordtype">id</span> = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga48d68b8666d99d28fa646ee1d2182b8f">osThreadNew</a> (Thread_1, NULL, NULL); <span class="comment">// create the thread</span></div>
-<div class="line"> <span class="comment">// do something</span></div>
-<div class="line"> status = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga2f8ba6dba6e9c065a6e236ffd410d74a">osThreadTerminate</a> (<span class="keywordtype">id</span>); <span class="comment">// stop the thread</span></div>
+<div class="line"> <span class="keywordtype">id</span> = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga48d68b8666d99d28fa646ee1d2182b8f">osThreadNew</a>(Thread_1, NULL, NULL); <span class="comment">// create the thread</span></div>
+<div class="line"> <span class="comment">// do something</span></div>
+<div class="line"> status = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga2f8ba6dba6e9c065a6e236ffd410d74a">osThreadTerminate</a>(<span class="keywordtype">id</span>); <span class="comment">// stop the thread</span></div>
<div class="line"> <span class="keywordflow">if</span> (status == <a class="code" href="cmsis__os2_8h.html#ga6c0dbe6069e4e7f47bb4cd32ae2b813ea9e1c9e2550bb4de8969a935acffc968f">osOK</a>) {</div>
-<div class="line"> <span class="comment">// Thread was terminated successfully</span></div>
-<div class="line"> }</div>
+<div class="line"> <span class="comment">// Thread was terminated successfully</span></div>
+<div class="line"> }</div>
<div class="line"> <span class="keywordflow">else</span> {</div>
-<div class="line"> <span class="comment">// Failed to terminate a thread</span></div>
-<div class="line"> }</div>
+<div class="line"> <span class="comment">// Failed to terminate a thread</span></div>
+<div class="line"> }</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
@@ -1455,7 +1462,7 @@ Avoid calling the function with a <em>thread_id</em> that does not exist or has
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
- <li class="footer">Generated on Wed Aug 1 2018 17:12:45 for CMSIS-RTOS2 by Arm Ltd. All rights reserved.
+ <li class="footer">Generated on Wed Jul 10 2019 15:21:04 for CMSIS-RTOS2 Version 2.1.3 by Arm Ltd. All rights reserved.
<!--
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6