<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Starting a Zephyr thread manually</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/99266/starting-a-zephyr-thread-manually</link><description>I am using Visual Studio for my creating software the nRF52840 running Zephyr. 
 I create a Zephyr thread using K_THREAD_DEFINE. All works fine, but I need to modify the code to start the task manually instead of after a delay, so I had planned to use</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 03 May 2023 03:11:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/99266/starting-a-zephyr-thread-manually" /><item><title>RE: Starting a Zephyr thread manually</title><link>https://devzone.nordicsemi.com/thread/423417?ContentTypeID=1</link><pubDate>Wed, 03 May 2023 03:11:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19fb3482-e631-4d0b-b3b7-1aa90169c6f3</guid><dc:creator>craig.goldman</dc:creator><description>&lt;p&gt;I tried your suggestion.&amp;nbsp; It seems to be working well.&lt;/p&gt;
&lt;p&gt;Thank you for the help.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Starting a Zephyr thread manually</title><link>https://devzone.nordicsemi.com/thread/423292?ContentTypeID=1</link><pubDate>Tue, 02 May 2023 12:33:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9886eaad-096f-4841-bac5-d905f5b88925</guid><dc:creator>Einarh</dc:creator><description>&lt;p&gt;Hello&lt;/p&gt;
&lt;p&gt;If you do not want to start a thread right away I believe you should be using &lt;code&gt;K_THREAD_STACK_DEFINE&lt;/code&gt; and &lt;code&gt;k_thread_create()&lt;/code&gt; rather than &lt;code&gt;K_THREAD_DEFINE&lt;/code&gt; as described here:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.zephyrproject.org/latest/kernel/services/threads/index.html#implementation"&gt;https://docs.zephyrproject.org/latest/kernel/services/threads/index.html#implementation&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I believe the description of &lt;code&gt;k_thread_start()&lt;/code&gt; is referring to &lt;code&gt;k_thread_create()&lt;/code&gt; and not &lt;code&gt;K_THREAD_DEFINE&lt;/code&gt;, as the note in the part about &lt;code&gt;K_THREAD_DEFINE&lt;/code&gt; says it uses a millisecond delay instead of the &lt;code&gt;k_timeout_t&lt;/code&gt; value in &lt;code&gt;k_thread_create()&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>