<?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>Main loop in Asset Tracker application</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/70493/main-loop-in-asset-tracker-application</link><description>Hello, 
 I was reading through the code of the asset tracker application and noticed that there is no while(1)/for(;;)-loop. I see this for the first time in a board application. All the other samples have a while(1)-loop. What happens after the last</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 15 Jan 2021 21:18:00 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/70493/main-loop-in-asset-tracker-application" /><item><title>RE: Main loop in Asset Tracker application</title><link>https://devzone.nordicsemi.com/thread/289526?ContentTypeID=1</link><pubDate>Fri, 15 Jan 2021 21:18:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:090c600e-ae20-43dc-b6da-dfa2e2418680</guid><dc:creator>andrew926</dc:creator><description>&lt;p&gt;Thank you!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Main loop in Asset Tracker application</title><link>https://devzone.nordicsemi.com/thread/289457?ContentTypeID=1</link><pubDate>Fri, 15 Jan 2021 14:09:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5fd45741-7c40-4f07-a8db-0dfac2b5b03a</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Got some information from the developers aswell!&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In the default case where the asset tracker uses nRF Cloud, the thread handling the cloud connection is found here: &lt;a title="https://github.com/nrfconnect/sdk-nrf/blob/6c63feff14df3da9d7171f9122d8cc66cd882bc9/subsys/net/lib/nrf_cloud/src/nrf_cloud.c#l494" href="https://github.com/nrfconnect/sdk-nrf/blob/6c63feff14df3da9d7171f9122d8cc66cd882bc9/subsys/net/lib/nrf_cloud/src/nrf_cloud.c#L494" rel="noopener noreferrer" target="_blank"&gt;https://github.com/nrfconnect/sdk-nrf/blob/6c63feff14df3da9d7171f9122d8cc66cd882bc9/subsys/net/lib/nrf_cloud/src/nrf_cloud.c#L494&lt;/a&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;The cloud event handler in asset tracker&amp;#39;s main.c is called from this thread context&lt;/div&gt;
&lt;div&gt;&lt;a title="https://github.com/nrfconnect/sdk-nrf/blob/6c63feff14df3da9d7171f9122d8cc66cd882bc9/applications/asset_tracker/src/main.c#l1391" href="https://github.com/nrfconnect/sdk-nrf/blob/6c63feff14df3da9d7171f9122d8cc66cd882bc9/applications/asset_tracker/src/main.c#L1391" rel="noopener noreferrer" target="_blank"&gt;https://github.com/nrfconnect/sdk-nrf/blob/6c63feff14df3da9d7171f9122d8cc66cd882bc9/applications/asset_tracker/src/main.c#L1391&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Best regards,&lt;br /&gt;Carl Richard&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Main loop in Asset Tracker application</title><link>https://devzone.nordicsemi.com/thread/289435?ContentTypeID=1</link><pubDate>Fri, 15 Jan 2021 13:23:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:02b65788-2411-4284-a894-51d215c4d96e</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Hi, Andrew!&lt;br /&gt;&lt;br /&gt;There is no particular need for main in NCS. In fact, some Zephyr samples doesn&amp;#39;t have a main at all! There will still be various threads running, e.g. in the drivers and workqueues. While I don&amp;#39;t remember all the details on how the asset_tracker does things, when the cloud responds to the connection request, a event handler will be called, which starts the next step, which triggers new events, etc.&lt;br /&gt;&lt;br /&gt;If you want to untangle it I suggest that you look for places where threads are started (sometimes before main) and items are put in workqueues.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Carl Richard&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>