<?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>Thread Safety In Ringbuf Library</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/57111/thread-safety-in-ringbuf-library</link><description>I&amp;#39;m reviewing the ringbuf library for use with FreeRTOS across two threads and I can&amp;#39;t see how the atomic operations implemented in the library make it thread safe. The atomic operations seem to prevent multiple writers or multiple readers from accessing</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 29 Jan 2020 12:12:01 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/57111/thread-safety-in-ringbuf-library" /><item><title>RE: Thread Safety In Ringbuf Library</title><link>https://devzone.nordicsemi.com/thread/231629?ContentTypeID=1</link><pubDate>Wed, 29 Jan 2020 12:12:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4fc49a67-37d4-47fd-b7ca-1b891158ebf7</guid><dc:creator>Krzysztof Chruscinski</dc:creator><description>&lt;p&gt;Hi Darren,&lt;/p&gt;
&lt;p&gt;note that to read the buffer you only read wr_idx and modify (tmp_)rd_idx and wr_idx is updated when data is already in the buffer (in nrf_ringbuf_cpy_put or nrf_ringbuf_put). Can you describe exact case when high priority task could read invalid data?&lt;/p&gt;
&lt;p&gt;regards,&lt;/p&gt;
&lt;p&gt;Krzysztof&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>