<?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: Thread specific data becomes easier in .NET 4.0 via ThreadLocal&lt;T&gt;</title>
	<atom:link href="http://reedcopsey.com/2009/11/12/thread-specific-data-becomes-easier-in-net-4-0-via-threadlocalt/feed/" rel="self" type="application/rss+xml" />
	<link>http://reedcopsey.com/2009/11/12/thread-specific-data-becomes-easier-in-net-4-0-via-threadlocalt/</link>
	<description>Thoughts on C#, WPF, .NET, and programming for Scientific Visualization</description>
	<lastBuildDate>Wed, 01 Feb 2012 16:38:09 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Reed</title>
		<link>http://reedcopsey.com/2009/11/12/thread-specific-data-becomes-easier-in-net-4-0-via-threadlocalt/#comment-1827</link>
		<dc:creator>Reed</dc:creator>
		<pubDate>Sat, 15 Oct 2011 16:21:41 +0000</pubDate>
		<guid isPermaLink="false">http://reedcopsey.com/?p=87#comment-1827</guid>
		<description>Gurmeet,

This can be accessed like any other variable.  The method in question will need to have some way to access the variable - whether its a ThreadLocal&lt;T&gt; or a normal variable.  If you pass a reference to the ThreadLocal&lt;T&gt; to the method, you can use it there directly.  Alternatively, you could wrap this in some other class to provide cleaner access, if required.  

-Reed</description>
		<content:encoded><![CDATA[<p>Gurmeet,</p>
<p>This can be accessed like any other variable.  The method in question will need to have some way to access the variable &#8211; whether its a ThreadLocal<t> or a normal variable.  If you pass a reference to the ThreadLocal</t><t> to the method, you can use it there directly.  Alternatively, you could wrap this in some other class to provide cleaner access, if required.  </p>
<p>-Reed</t></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gravitas</title>
		<link>http://reedcopsey.com/2009/11/12/thread-specific-data-becomes-easier-in-net-4-0-via-threadlocalt/#comment-1826</link>
		<dc:creator>Gravitas</dc:creator>
		<pubDate>Sat, 15 Oct 2011 11:26:25 +0000</pubDate>
		<guid isPermaLink="false">http://reedcopsey.com/?p=87#comment-1826</guid>
		<description>Excellent article. ThreadLocal is incredibly powerful - it allows you to convert any class that is not thread safe into one that is. Each class runs in its own &quot;sandbox&quot;, the universe of variables that it sees are based on the ThreadID.

I actually manually implemented the effect of ThreadLocal a week ago - its a nice feeling knowing I can use ThreadLocal to replace all of my prior code.

To implement the effect of ThreadLocal yourself, create a wrapper over a non-thread-safe class which uses a dictionary to create a new class instance for each ThreadID (the key for the dictionary is the ThreadID). This means that if one thread is in the middle of doing something, another thread cannot come along and corrupt any class variables (by calling .ResetCounter(), for example).

ThreadLocal is incredibly powerful - it allows you to convert any class that is not thread safe into one that is.

 Your article also beats the MSDN one for understandability by an order of magnitude.</description>
		<content:encoded><![CDATA[<p>Excellent article. ThreadLocal is incredibly powerful &#8211; it allows you to convert any class that is not thread safe into one that is. Each class runs in its own &#8220;sandbox&#8221;, the universe of variables that it sees are based on the ThreadID.</p>
<p>I actually manually implemented the effect of ThreadLocal a week ago &#8211; its a nice feeling knowing I can use ThreadLocal to replace all of my prior code.</p>
<p>To implement the effect of ThreadLocal yourself, create a wrapper over a non-thread-safe class which uses a dictionary to create a new class instance for each ThreadID (the key for the dictionary is the ThreadID). This means that if one thread is in the middle of doing something, another thread cannot come along and corrupt any class variables (by calling .ResetCounter(), for example).</p>
<p>ThreadLocal is incredibly powerful &#8211; it allows you to convert any class that is not thread safe into one that is.</p>
<p> Your article also beats the MSDN one for understandability by an order of magnitude.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gurmeet</title>
		<link>http://reedcopsey.com/2009/11/12/thread-specific-data-becomes-easier-in-net-4-0-via-threadlocalt/#comment-1825</link>
		<dc:creator>Gurmeet</dc:creator>
		<pubDate>Fri, 14 Oct 2011 11:06:50 +0000</pubDate>
		<guid isPermaLink="false">http://reedcopsey.com/?p=87#comment-1825</guid>
		<description>I mean some other function called from this method but executing under the same thread context</description>
		<content:encoded><![CDATA[<p>I mean some other function called from this method but executing under the same thread context</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gurmeet</title>
		<link>http://reedcopsey.com/2009/11/12/thread-specific-data-becomes-easier-in-net-4-0-via-threadlocalt/#comment-1824</link>
		<dc:creator>Gurmeet</dc:creator>
		<pubDate>Fri, 14 Oct 2011 11:05:47 +0000</pubDate>
		<guid isPermaLink="false">http://reedcopsey.com/?p=87#comment-1824</guid>
		<description>How do i use it if i want to access the dataPerThread.Value when i need to use it in some other function ?</description>
		<content:encoded><![CDATA[<p>How do i use it if i want to access the dataPerThread.Value when i need to use it in some other function ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: S</title>
		<link>http://reedcopsey.com/2009/11/12/thread-specific-data-becomes-easier-in-net-4-0-via-threadlocalt/#comment-1750</link>
		<dc:creator>S</dc:creator>
		<pubDate>Tue, 12 Jul 2011 02:39:03 +0000</pubDate>
		<guid isPermaLink="false">http://reedcopsey.com/?p=87#comment-1750</guid>
		<description>Thanks Reed for the post. MSDN wasnt helping me grasping ThreadLocal. your post surely did.</description>
		<content:encoded><![CDATA[<p>Thanks Reed for the post. MSDN wasnt helping me grasping ThreadLocal. your post surely did.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reed</title>
		<link>http://reedcopsey.com/2009/11/12/thread-specific-data-becomes-easier-in-net-4-0-via-threadlocalt/#comment-685</link>
		<dc:creator>Reed</dc:creator>
		<pubDate>Thu, 04 Feb 2010 22:38:54 +0000</pubDate>
		<guid isPermaLink="false">http://reedcopsey.com/?p=87#comment-685</guid>
		<description>Jeff,

I responded to your SO post with details.  Hopefully that will help you a bit.

If you&#039;re still having problems, or have more questions, let me know.

-Reed</description>
		<content:encoded><![CDATA[<p>Jeff,</p>
<p>I responded to your SO post with details.  Hopefully that will help you a bit.</p>
<p>If you&#8217;re still having problems, or have more questions, let me know.</p>
<p>-Reed</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Sternal</title>
		<link>http://reedcopsey.com/2009/11/12/thread-specific-data-becomes-easier-in-net-4-0-via-threadlocalt/#comment-684</link>
		<dc:creator>Jeff Sternal</dc:creator>
		<pubDate>Thu, 04 Feb 2010 22:13:59 +0000</pubDate>
		<guid isPermaLink="false">http://reedcopsey.com/?p=87#comment-684</guid>
		<description>Howdy, Reed - I stumbled across this while trying to find the answer to a question I just posted on SO: http://stackoverflow.com/questions/2202735/what-are-the-advantages-of-thread-local-storage. I&#039;m digesting your example at the end of this article &amp; suspect it may answer my question. Might you have a pithy, SO-friendly answer that explains the use case for instance-level thread-local storage? :)</description>
		<content:encoded><![CDATA[<p>Howdy, Reed &#8211; I stumbled across this while trying to find the answer to a question I just posted on SO: <a href="http://stackoverflow.com/questions/2202735/what-are-the-advantages-of-thread-local-storage" rel="nofollow">http://stackoverflow.com/questions/2202735/what-are-the-advantages-of-thread-local-storage</a>. I&#8217;m digesting your example at the end of this article &amp; suspect it may answer my question. Might you have a pithy, SO-friendly answer that explains the use case for instance-level thread-local storage? <img src='http://reedcopsey.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
 
