<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Multithreaded simple data type access and atomic variables</title>
	<atom:link href="http://www.alexonlinux.com/multithreaded-simple-data-type-access-and-atomic-variables/feed" rel="self" type="application/rss+xml" />
	<link>http://www.alexonlinux.com/multithreaded-simple-data-type-access-and-atomic-variables</link>
	<description></description>
	<lastBuildDate>Sun, 05 Feb 2012 21:17:46 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: Alexander Sandler</title>
		<link>http://www.alexonlinux.com/multithreaded-simple-data-type-access-and-atomic-variables/comment-page-1#comment-28429</link>
		<dc:creator>Alexander Sandler</dc:creator>
		<pubDate>Sun, 05 Feb 2012 20:39:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexandersandler.net/?page_id=770#comment-28429</guid>
		<description>&lt;a href=&#039;#comment-27528&#039; rel=&quot;nofollow&quot;&gt;@yt&lt;/a&gt;
Yes, your implementation uses i386 assembler. Whenever you try to do something like this on some other platform, it probably will not compile.&lt;div class=&quot;comment-remix-meta&quot;&gt;&lt;a href=&quot;#&quot; class=&quot;replyto&quot; onclick=&quot;replyto(&#039;28429&#039;,&#039;Alexander Sandler&#039;); return false;&quot;&gt;Reply&lt;/a&gt;  - &lt;a href=&quot;#&quot; class=&quot;quote&quot; onclick=&quot;quote(&#039;28429&#039;,&#039;Alexander Sandler&#039;,&#039;&lt;a href=\&#039;#comment-27528\&#039; rel=\&quot;nofollow\&quot;&gt;@yt&lt;\/a&gt;\r\nYes, your implementation uses i386 assembler. Whenever you try to do something like this on some other platform, it probably will not compile.&#039;); return false;&quot;&gt;Quote&lt;/a&gt;&lt;/div&gt;</description>
		<content:encoded><![CDATA[<p><a href="#comment-27528' rel="nofollow">@yt</a><br />
Yes, your implementation uses i386 assembler. Whenever you try to do something like this on some other platform, it probably will not compile.
<div class="comment-remix-meta"><a href="#" class="replyto" onclick="replyto('28429','Alexander Sandler'); return false;">Reply</a>  &#8211; <a href="#" class="quote" onclick="quote('28429','Alexander Sandler','&lt;a href=\'#comment-27528\' rel=\&quot;nofollow\&quot;&gt;@yt&lt;\/a&gt;\r\nYes, your implementation uses i386 assembler. Whenever you try to do something like this on some other platform, it probably will not compile.'); return false;">Quote</a></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: yt</title>
		<link>http://www.alexonlinux.com/multithreaded-simple-data-type-access-and-atomic-variables/comment-page-1#comment-27528</link>
		<dc:creator>yt</dc:creator>
		<pubDate>Sun, 16 Oct 2011 07:39:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexandersandler.net/?page_id=770#comment-27528</guid>
		<description>Thanks Alex,I has found we can implement these function by gcc asm,like __sync_fetch_and_add,I write this:
typedef atomic_t int;
static inline atomic_t fetch_and_add(atomic_t *value,atomic_t key)
{
  asm volatile(&quot;lock;addl %1,%0&quot;
               :&quot;+m&quot;(*value)
               :&quot;ir&quot;(key)
               :&quot;memory&quot;);
  return *value;
}
but it&#039;s limited for intel x86,reference this in detail:
http://lxr.linux.no/linux+v2.6.26.4/include/asm-x86/atomic_32.h&lt;div class=&quot;comment-remix-meta&quot;&gt;&lt;a href=&quot;#&quot; class=&quot;replyto&quot; onclick=&quot;replyto(&#039;27528&#039;,&#039;yt&#039;); return false;&quot;&gt;Reply&lt;/a&gt;  - &lt;a href=&quot;#&quot; class=&quot;quote&quot; onclick=&quot;quote(&#039;27528&#039;,&#039;yt&#039;,&#039;Thanks Alex,I has found we can implement these function by gcc asm,like __sync_fetch_and_add,I write this:\r\ntypedef atomic_t int;\r\nstatic inline atomic_t fetch_and_add(atomic_t *value,atomic_t key)\r\n{\r\n  asm volatile(\&quot;lock;addl %1,%0\&quot;\r\n               :\&quot;+m\&quot;(*value)\r\n               :\&quot;ir\&quot;(key)\r\n               :\&quot;memory\&quot;);\r\n  return *value;\r\n}\r\nbut it\&#039;s limited for intel x86,reference this in detail:\r\nhttp:\/\/lxr.linux.no\/linux+v2.6.26.4\/include\/asm-x86\/atomic_32.h&#039;); return false;&quot;&gt;Quote&lt;/a&gt;&lt;/div&gt;</description>
		<content:encoded><![CDATA[<p>Thanks Alex,I has found we can implement these function by gcc asm,like __sync_fetch_and_add,I write this:<br />
typedef atomic_t int;<br />
static inline atomic_t fetch_and_add(atomic_t *value,atomic_t key)<br />
{<br />
  asm volatile(&#8220;lock;addl %1,%0&#8243;<br />
               :&#8221;+m&#8221;(*value)<br />
               :&#8221;ir&#8221;(key)<br />
               :&#8221;memory&#8221;);<br />
  return *value;<br />
}<br />
but it&#8217;s limited for intel x86,reference this in detail:<br />
<a href="http://lxr.linux.no/linux+v2.6.26.4/include/asm-x86/atomic_32.h" onclick="return TrackClick('http%3A%2F%2Flxr.linux.no%2Flinux%2Bv2.6.26.4%2Finclude%2Fasm-x86%2Fatomic_32.h','http%3A%2F%2Flxr.linux.no%2Flinux%2Bv2.6.26.4%2Finclude%2Fasm-x86%2Fatomic_32.h')" rel="nofollow">http://lxr.linux.no/linux+v2.6.26.4/include/asm-x86/atomic_32.h</a>
<div class="comment-remix-meta"><a href="#" class="replyto" onclick="replyto('27528','yt'); return false;">Reply</a>  &#8211; <a href="#" class="quote" onclick="quote('27528','yt','Thanks Alex,I has found we can implement these function by gcc asm,like __sync_fetch_and_add,I write this:\r\ntypedef atomic_t int;\r\nstatic inline atomic_t fetch_and_add(atomic_t *value,atomic_t key)\r\n{\r\n  asm volatile(\&quot;lock;addl %1,%0\&quot;\r\n               :\&quot;+m\&quot;(*value)\r\n               :\&quot;ir\&quot;(key)\r\n               :\&quot;memory\&quot;);\r\n  return *value;\r\n}\r\nbut it\'s limited for intel x86,reference this in detail:\r\nhttp:\/\/lxr.linux.no\/linux+v2.6.26.4\/include\/asm-x86\/atomic_32.h'); return false;">Quote</a></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alain Spineux</title>
		<link>http://www.alexonlinux.com/multithreaded-simple-data-type-access-and-atomic-variables/comment-page-1#comment-25382</link>
		<dc:creator>Alain Spineux</dc:creator>
		<pubDate>Fri, 08 Apr 2011 11:08:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexandersandler.net/?page_id=770#comment-25382</guid>
		<description>This and the two before are great articles, useful and pleasant to read.
Thanks&lt;div class=&quot;comment-remix-meta&quot;&gt;&lt;a href=&quot;#&quot; class=&quot;replyto&quot; onclick=&quot;replyto(&#039;25382&#039;,&#039;Alain Spineux&#039;); return false;&quot;&gt;Reply&lt;/a&gt;  - &lt;a href=&quot;#&quot; class=&quot;quote&quot; onclick=&quot;quote(&#039;25382&#039;,&#039;Alain Spineux&#039;,&#039;This and the two before are great articles, useful and pleasant to read.\r\nThanks&#039;); return false;&quot;&gt;Quote&lt;/a&gt;&lt;/div&gt;</description>
		<content:encoded><![CDATA[<p>This and the two before are great articles, useful and pleasant to read.<br />
Thanks
<div class="comment-remix-meta"><a href="#" class="replyto" onclick="replyto('25382','Alain Spineux'); return false;">Reply</a>  &#8211; <a href="#" class="quote" onclick="quote('25382','Alain Spineux','This and the two before are great articles, useful and pleasant to read.\r\nThanks'); return false;">Quote</a></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: 簡單而有趣的雙執行緒同步問題 &#171; Hitripod</title>
		<link>http://www.alexonlinux.com/multithreaded-simple-data-type-access-and-atomic-variables/comment-page-1#comment-24758</link>
		<dc:creator>簡單而有趣的雙執行緒同步問題 &#171; Hitripod</dc:creator>
		<pubDate>Tue, 11 Jan 2011 17:28:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexandersandler.net/?page_id=770#comment-24758</guid>
		<description></description>
		<content:encoded><![CDATA[<p>[...] 今天看到一系列有趣的文章：1, 2, 3 [...]
<div class="comment-remix-meta"><a href="#" class="replyto" onclick="replyto('24758','&ccedil;&deg;&iexcl;&aring;&reg;&egrave;&aelig;&egrave;&para;&pound;&ccedil;&eacute;&aring;&middot;&egrave;&iexcl;&ccedil;&middot;&aring;&aelig;&shy;&yen;&aring;&eacute;&iexcl; &amp;laquo; Hitripod'); return false;">Reply</a>  &#8211; <a href="#" class="quote" onclick="quote('24758','&ccedil;&deg;&iexcl;&aring;&reg;&egrave;&aelig;&egrave;&para;&pound;&ccedil;&eacute;&aring;&middot;&egrave;&iexcl;&ccedil;&middot;&aring;&aelig;&shy;&yen;&aring;&eacute;&iexcl; &amp;laquo; Hitripod','&amp;#91;...&amp;#93; &auml;&raquo;&aring;&curren;&copy;&ccedil;&aring;&deg;&auml;&cedil;&ccedil;&sup3;&raquo;&aring;&aelig;&egrave;&para;&pound;&ccedil;&aelig;&ccedil;&laquo;&nbsp;&iuml;&frac14;1, 2, 3 &amp;#91;...&amp;#93;'); return false;">Quote</a></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zamir</title>
		<link>http://www.alexonlinux.com/multithreaded-simple-data-type-access-and-atomic-variables/comment-page-1#comment-24450</link>
		<dc:creator>Zamir</dc:creator>
		<pubDate>Tue, 02 Nov 2010 15:48:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexandersandler.net/?page_id=770#comment-24450</guid>
		<description>Alex,
This is a wonderful piece. Thank you for helping us understand atomic operations in C!&lt;div class=&quot;comment-remix-meta&quot;&gt;&lt;a href=&quot;#&quot; class=&quot;replyto&quot; onclick=&quot;replyto(&#039;24450&#039;,&#039;Zamir&#039;); return false;&quot;&gt;Reply&lt;/a&gt;  - &lt;a href=&quot;#&quot; class=&quot;quote&quot; onclick=&quot;quote(&#039;24450&#039;,&#039;Zamir&#039;,&#039;Alex,\r\nThis is a wonderful piece. Thank you for helping us understand atomic operations in C!&#039;); return false;&quot;&gt;Quote&lt;/a&gt;&lt;/div&gt;</description>
		<content:encoded><![CDATA[<p>Alex,<br />
This is a wonderful piece. Thank you for helping us understand atomic operations in C!
<div class="comment-remix-meta"><a href="#" class="replyto" onclick="replyto('24450','Zamir'); return false;">Reply</a>  &#8211; <a href="#" class="quote" onclick="quote('24450','Zamir','Alex,\r\nThis is a wonderful piece. Thank you for helping us understand atomic operations in C!'); return false;">Quote</a></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mohammed Shahid</title>
		<link>http://www.alexonlinux.com/multithreaded-simple-data-type-access-and-atomic-variables/comment-page-1#comment-24357</link>
		<dc:creator>Mohammed Shahid</dc:creator>
		<pubDate>Sat, 09 Oct 2010 18:45:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexandersandler.net/?page_id=770#comment-24357</guid>
		<description>Wouldn&#039;t __sync_fetch_and_sub correspond to fetch-and-subtract rather than fetch-and-substitute ?&lt;div class=&quot;comment-remix-meta&quot;&gt;&lt;a href=&quot;#&quot; class=&quot;replyto&quot; onclick=&quot;replyto(&#039;24357&#039;,&#039;Mohammed Shahid&#039;); return false;&quot;&gt;Reply&lt;/a&gt;  - &lt;a href=&quot;#&quot; class=&quot;quote&quot; onclick=&quot;quote(&#039;24357&#039;,&#039;Mohammed Shahid&#039;,&#039;Wouldn\&#039;t __sync_fetch_and_sub correspond to fetch-and-subtract rather than fetch-and-substitute ?&#039;); return false;&quot;&gt;Quote&lt;/a&gt;&lt;/div&gt;</description>
		<content:encoded><![CDATA[<p>Wouldn&#8217;t __sync_fetch_and_sub correspond to fetch-and-subtract rather than fetch-and-substitute ?
<div class="comment-remix-meta"><a href="#" class="replyto" onclick="replyto('24357','Mohammed Shahid'); return false;">Reply</a>  &#8211; <a href="#" class="quote" onclick="quote('24357','Mohammed Shahid','Wouldn\'t __sync_fetch_and_sub correspond to fetch-and-subtract rather than fetch-and-substitute ?'); return false;">Quote</a></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Cole</title>
		<link>http://www.alexonlinux.com/multithreaded-simple-data-type-access-and-atomic-variables/comment-page-1#comment-24296</link>
		<dc:creator>Michael Cole</dc:creator>
		<pubDate>Wed, 22 Sep 2010 15:59:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexandersandler.net/?page_id=770#comment-24296</guid>
		<description>Exceptionally beneficial bless you, It looks like your trusty readers would most likely want far more writing of this nature carry on the excellent work.&lt;div class=&quot;comment-remix-meta&quot;&gt;&lt;a href=&quot;#&quot; class=&quot;replyto&quot; onclick=&quot;replyto(&#039;24296&#039;,&#039;Michael Cole&#039;); return false;&quot;&gt;Reply&lt;/a&gt;  - &lt;a href=&quot;#&quot; class=&quot;quote&quot; onclick=&quot;quote(&#039;24296&#039;,&#039;Michael Cole&#039;,&#039;Exceptionally beneficial bless you, It looks like your trusty readers would most likely want far more writing of this nature carry on the excellent work.&#039;); return false;&quot;&gt;Quote&lt;/a&gt;&lt;/div&gt;</description>
		<content:encoded><![CDATA[<p>Exceptionally beneficial bless you, It looks like your trusty readers would most likely want far more writing of this nature carry on the excellent work.
<div class="comment-remix-meta"><a href="#" class="replyto" onclick="replyto('24296','Michael Cole'); return false;">Reply</a>  &#8211; <a href="#" class="quote" onclick="quote('24296','Michael Cole','Exceptionally beneficial bless you, It looks like your trusty readers would most likely want far more writing of this nature carry on the excellent work.'); return false;">Quote</a></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexander Sandler</title>
		<link>http://www.alexonlinux.com/multithreaded-simple-data-type-access-and-atomic-variables/comment-page-1#comment-24255</link>
		<dc:creator>Alexander Sandler</dc:creator>
		<pubDate>Mon, 13 Sep 2010 13:19:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexandersandler.net/?page_id=770#comment-24255</guid>
		<description>&lt;a href=&#039;#comment-24164&#039; rel=&quot;nofollow&quot;&gt;@Manju&lt;/a&gt;
1. __sync_fetch_and_add(pts, 0) is the way!
2. The question of interrupt safety is irrelevant here because all these functions translate into single processor instruction - interrupts land between instructions, not in the middle of an instruction.
3. There are couple of solutions for this. Most of them are not pretty. First there&#039;s a __sync_lock_test_and_set(). gcc documentation says that one should be careful when using this function because it is not implemented on all gcc platforms. Should be safe on Intel though.
Another option is to do assignments before you use the variable atomically and then to do relative adjustments only (those you can do atomically). This is not very convenient, but this is all gcc got.
Hope it helps.&lt;div class=&quot;comment-remix-meta&quot;&gt;&lt;a href=&quot;#&quot; class=&quot;replyto&quot; onclick=&quot;replyto(&#039;24255&#039;,&#039;Alexander Sandler&#039;); return false;&quot;&gt;Reply&lt;/a&gt;  - &lt;a href=&quot;#&quot; class=&quot;quote&quot; onclick=&quot;quote(&#039;24255&#039;,&#039;Alexander Sandler&#039;,&#039;&lt;a href=\&#039;#comment-24164\&#039; rel=\&quot;nofollow\&quot;&gt;@Manju&lt;\/a&gt;\r\n1. __sync_fetch_and_add(pts, 0) is the way!\r\n2. The question of interrupt safety is irrelevant here because all these functions translate into single processor instruction - interrupts land between instructions, not in the middle of an instruction.\r\n3. There are couple of solutions for this. Most of them are not pretty. First there\&#039;s a __sync_lock_test_and_set(). gcc documentation says that one should be careful when using this function because it is not implemented on all gcc platforms. Should be safe on Intel though.\r\nAnother option is to do assignments before you use the variable atomically and then to do relative adjustments only (those you can do atomically). This is not very convenient, but this is all gcc got.\r\nHope it helps.&#039;); return false;&quot;&gt;Quote&lt;/a&gt;&lt;/div&gt;</description>
		<content:encoded><![CDATA[<p><a href="#comment-24164' rel="nofollow">@Manju</a><br />
1. __sync_fetch_and_add(pts, 0) is the way!<br />
2. The question of interrupt safety is irrelevant here because all these functions translate into single processor instruction &#8211; interrupts land between instructions, not in the middle of an instruction.<br />
3. There are couple of solutions for this. Most of them are not pretty. First there&#8217;s a __sync_lock_test_and_set(). gcc documentation says that one should be careful when using this function because it is not implemented on all gcc platforms. Should be safe on Intel though.<br />
Another option is to do assignments before you use the variable atomically and then to do relative adjustments only (those you can do atomically). This is not very convenient, but this is all gcc got.<br />
Hope it helps.
<div class="comment-remix-meta"><a href="#" class="replyto" onclick="replyto('24255','Alexander Sandler'); return false;">Reply</a>  &#8211; <a href="#" class="quote" onclick="quote('24255','Alexander Sandler','&lt;a href=\'#comment-24164\' rel=\&quot;nofollow\&quot;&gt;@Manju&lt;\/a&gt;\r\n1. __sync_fetch_and_add(pts, 0) is the way!\r\n2. The question of interrupt safety is irrelevant here because all these functions translate into single processor instruction - interrupts land between instructions, not in the middle of an instruction.\r\n3. There are couple of solutions for this. Most of them are not pretty. First there\'s a __sync_lock_test_and_set(). gcc documentation says that one should be careful when using this function because it is not implemented on all gcc platforms. Should be safe on Intel though.\r\nAnother option is to do assignments before you use the variable atomically and then to do relative adjustments only (those you can do atomically). This is not very convenient, but this is all gcc got.\r\nHope it helps.'); return false;">Quote</a></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Manju</title>
		<link>http://www.alexonlinux.com/multithreaded-simple-data-type-access-and-atomic-variables/comment-page-1#comment-24164</link>
		<dc:creator>Manju</dc:creator>
		<pubDate>Sun, 29 Aug 2010 04:43:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexandersandler.net/?page_id=770#comment-24164</guid>
		<description>One more
3. whats the equivalent of atomic_set ?
   I see in atomic.h that atomic_set is defined as
#define atomic_read(v)          ((v)-&gt;counter)
So a normal assignment statement should be safe here ?&lt;div class=&quot;comment-remix-meta&quot;&gt;&lt;a href=&quot;#&quot; class=&quot;replyto&quot; onclick=&quot;replyto(&#039;24164&#039;,&#039;Manju&#039;); return false;&quot;&gt;Reply&lt;/a&gt;  - &lt;a href=&quot;#&quot; class=&quot;quote&quot; onclick=&quot;quote(&#039;24164&#039;,&#039;Manju&#039;,&#039;One more\r\n3. whats the equivalent of atomic_set ?\r\n   I see in atomic.h that atomic_set is defined as\r\n#define atomic_read(v)          ((v)-&gt;counter)\r\nSo a normal assignment statement should be safe here ?&#039;); return false;&quot;&gt;Quote&lt;/a&gt;&lt;/div&gt;</description>
		<content:encoded><![CDATA[<p>One more<br />
3. whats the equivalent of atomic_set ?<br />
   I see in atomic.h that atomic_set is defined as<br />
#define atomic_read(v)          ((v)-&gt;counter)<br />
So a normal assignment statement should be safe here ?
<div class="comment-remix-meta"><a href="#" class="replyto" onclick="replyto('24164','Manju'); return false;">Reply</a>  &#8211; <a href="#" class="quote" onclick="quote('24164','Manju','One more\r\n3. whats the equivalent of atomic_set ?\r\n   I see in atomic.h that atomic_set is defined as\r\n#define atomic_read(v)          ((v)-&amp;gt;counter)\r\nSo a normal assignment statement should be safe here ?'); return false;">Quote</a></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Manju</title>
		<link>http://www.alexonlinux.com/multithreaded-simple-data-type-access-and-atomic-variables/comment-page-1#comment-24162</link>
		<dc:creator>Manju</dc:creator>
		<pubDate>Sun, 29 Aug 2010 04:30:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexandersandler.net/?page_id=770#comment-24162</guid>
		<description>Hello Alex,
Thanks for informative article and interesting conversations following that.
I have two queries.
1. I need to do a automic_read which of the __sync shd I use.
  __sync_fetch_and_add(pts, 0)  be fine ? or is there any other specific function for read

2. Are sync* function interrupt safe ? i.e. will gcc take care of disabling interrupts while performing these operations ?

Thanks&lt;div class=&quot;comment-remix-meta&quot;&gt;&lt;a href=&quot;#&quot; class=&quot;replyto&quot; onclick=&quot;replyto(&#039;24162&#039;,&#039;Manju&#039;); return false;&quot;&gt;Reply&lt;/a&gt;  - &lt;a href=&quot;#&quot; class=&quot;quote&quot; onclick=&quot;quote(&#039;24162&#039;,&#039;Manju&#039;,&#039;Hello Alex,\r\nThanks for informative article and interesting conversations following that.\r\nI have two queries.\r\n1. I need to do a automic_read which of the __sync shd I use.\r\n  __sync_fetch_and_add(pts, 0)  be fine ? or is there any other specific function for read\r\n\r\n2. Are sync* function interrupt safe ? i.e. will gcc take care of disabling interrupts while performing these operations ?\r\n\r\nThanks&#039;); return false;&quot;&gt;Quote&lt;/a&gt;&lt;/div&gt;</description>
		<content:encoded><![CDATA[<p>Hello Alex,<br />
Thanks for informative article and interesting conversations following that.<br />
I have two queries.<br />
1. I need to do a automic_read which of the __sync shd I use.<br />
  __sync_fetch_and_add(pts, 0)  be fine ? or is there any other specific function for read</p>
<p>2. Are sync* function interrupt safe ? i.e. will gcc take care of disabling interrupts while performing these operations ?</p>
<p>Thanks
<div class="comment-remix-meta"><a href="#" class="replyto" onclick="replyto('24162','Manju'); return false;">Reply</a>  &#8211; <a href="#" class="quote" onclick="quote('24162','Manju','Hello Alex,\r\nThanks for informative article and interesting conversations following that.\r\nI have two queries.\r\n1. I need to do a automic_read which of the __sync shd I use.\r\n  __sync_fetch_and_add(pts, 0)  be fine ? or is there any other specific function for read\r\n\r\n2. Are sync* function interrupt safe ? i.e. will gcc take care of disabling interrupts while performing these operations ?\r\n\r\nThanks'); return false;">Quote</a></div>
]]></content:encoded>
	</item>
</channel>
</rss>

