<?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>Declaring suspended threads</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/108540/declaring-suspended-threads</link><description>Hi! 
 
 I&amp;#39;m trying to write a small library for myself. It would need a thread to do some background stuff. In my library I would have a stuffInit() function to set up things, but I don&amp;#39;t want much to happen before calling this function (it it will be</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 22 Feb 2024 13:51:40 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/108540/declaring-suspended-threads" /><item><title>RE: Declaring suspended threads</title><link>https://devzone.nordicsemi.com/thread/470280?ContentTypeID=1</link><pubDate>Thu, 22 Feb 2024 13:51:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a398875-e4fb-4a46-8bc3-642e4bc27938</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I think the best option would be to use a semaphore with K_FOREVER wait in the start of the thread and give the semaphore whenever the thread should start. You can see an example of this in the peripheral_uart sample, where the semaphore is &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v2.5.2/samples/bluetooth/peripheral_uart/src/main.c#L57"&gt;defined&lt;/a&gt;, &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v2.5.2/samples/bluetooth/peripheral_uart/src/main.c#L634"&gt;taken&lt;/a&gt;&amp;nbsp;and &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v2.5.2/samples/bluetooth/peripheral_uart/src/main.c#L606"&gt;given&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>