<?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>Issue with blocking wait using app_timer</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/52324/issue-with-blocking-wait-using-app_timer</link><description>Hello everyone, I am trying to implement a blocking wait using the app_timer. 
 To do this, I am starting a one-shot timer whose callback function sets an initially false flag to true. 
 I tried to &amp;quot;block&amp;quot; using the following code: 
 
 
 However, when</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 20 Sep 2019 14:10:18 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/52324/issue-with-blocking-wait-using-app_timer" /><item><title>RE: Issue with blocking wait using app_timer</title><link>https://devzone.nordicsemi.com/thread/210975?ContentTypeID=1</link><pubDate>Fri, 20 Sep 2019 14:10:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f16b6e5f-07c5-4784-a332-de47707abbe0</guid><dc:creator>alnordic</dc:creator><description>&lt;p&gt;Hi RK, thank you for your answer.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;It seems that there was indeed an issue with priority. The timer handler was not executed until my application code returned.&lt;/p&gt;
&lt;p&gt;The &amp;quot;Application Timer&amp;quot; documentation also discusses priority.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Instead, I used an RTC directly, whose handler was not blocked.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with blocking wait using app_timer</title><link>https://devzone.nordicsemi.com/thread/210571?ContentTypeID=1</link><pubDate>Thu, 19 Sep 2019 02:17:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c5ab5109-e92b-47cb-b43f-e5b7bfd672ff</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;well you&amp;#39;ve given no context as to where you&amp;#39;re calling this code from. If you&amp;#39;re calling it from another timer handler or an IRQ handler with higher priority you&amp;#39;re blocking your own interrupts and so you&amp;#39;ll never get the callback. 99% that&amp;#39;s what you&amp;#39;re doing.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The recommended way to implement an accurate blocking wait is not to. Blocking waits waste power and, as you&amp;#39;re finding out, can cause you to deadlock yourself or block other events which need processing. Make your code asynchronous, implement state machines and get away from blocking anything.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>