<?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>NRF fundamental course lesson 8 exercise 1</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/120477/nrf-fundamental-course-lesson-8-exercise-1</link><description>Hello, 
 I have a question about the NRF SDK fundamental lesson 8 exercise 1. In the code below get_access and release_access are executed in different threads. The semaphore is initialized with count of 10. Since the semaphore count is greater than zero</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 08 Apr 2025 05:05:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/120477/nrf-fundamental-course-lesson-8-exercise-1" /><item><title>RE: NRF fundamental course lesson 8 exercise 1</title><link>https://devzone.nordicsemi.com/thread/530923?ContentTypeID=1</link><pubDate>Tue, 08 Apr 2025 05:05:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1421d464-733e-4156-8077-a92c2b25cd73</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;That is great observation Sam, I wrote this lesson and I see that there is room for improvement here. Theoretically,&amp;nbsp;&lt;span&gt;available_instance_count is prone to corruption&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I think you understand the mutual exclusion thing properly. I think we got lucky here are the window where the race condition happens is relatively small and somehow the compiler managed to access this variable in an atomic way. I should have just made this variable atomic to remove the possible race condition window.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>