<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.com/utility/FeedStylesheets/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/"><channel><title>Multithreading: using fences from .NET code</title><link>http://msmvps.com/blogs/luisabreu/archive/2009/07/03/multithreading-using-fences-from-net-code.aspx</link><description>In the last post , we’ve talked about memory fences. Today we’re going to keep looking at this topic, but we’re turning our attention to coding, ie, we’re going to talk about the options we have to add fences to our classes. In .NET, things are relatively</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>re: Multithreading: using fences from .NET code</title><link>http://msmvps.com/blogs/luisabreu/archive/2009/07/03/multithreading-using-fences-from-net-code.aspx#1698395</link><pubDate>Mon, 06 Jul 2009 11:27:26 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1698395</guid><dc:creator>Ivan Kotev</dc:creator><description>&lt;p&gt;One small addition. In their current implementation VolatileRead and VolatileWrite use full memory fence. The internal implementation(Of course that can be changed) is:&lt;/p&gt;
&lt;p&gt;public static int VolatileRead(ref int address)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;int num = address;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;MemoryBarrier();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;return num;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1698395" width="1" height="1"&gt;</description></item></channel></rss>