<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.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>Do you use LazyInitMode.AllowMultipleExecution?</title><link>http://blogs.msdn.com/b/pfxteam/archive/2009/04/03/9529966.aspx</link><description>In an effort to release simple, streamlined APIs, we spend a lot of time poring over every aspect of our types. One of the types that we know is getting used a lot both internally and externally is LazyInit&amp;lt;T&amp;gt;.&amp;#160; One of LazyInit&amp;lt;T&amp;gt;’s constructors</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Do you use LazyInitMode.AllowMultipleExecution?</title><link>http://blogs.msdn.com/b/pfxteam/archive/2009/04/03/9529966.aspx#9531352</link><pubDate>Sat, 04 Apr 2009 14:23:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9531352</guid><dc:creator>_</dc:creator><description>&lt;p&gt;i think it is not unlikely to have thousands of lazyinit instances. imagine a tree data structure whose children are lazily initialized by a cheap operation which is idempotent.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9531352" width="1" height="1"&gt;</description></item><item><title>re: Do you use LazyInitMode.AllowMultipleExecution?</title><link>http://blogs.msdn.com/b/pfxteam/archive/2009/04/03/9529966.aspx#9531145</link><pubDate>Sat, 04 Apr 2009 04:46:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9531145</guid><dc:creator>Ben</dc:creator><description>&lt;p&gt;While we don't use LazyInit itself, we use a similar coding pattern for the following reasons:&lt;/p&gt;
&lt;p&gt; - The operation is slow enough we want to cache the result&lt;/p&gt;
&lt;p&gt; - The operation cannot block&lt;/p&gt;
&lt;p&gt; - Usually, there is only 1 thread doing this&lt;/p&gt;
&lt;p&gt; - We don't care if it returns different values on different threads&lt;/p&gt;
&lt;p&gt;This is used purely as a speed boost to operations that run a 2nd time.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9531145" width="1" height="1"&gt;</description></item><item><title>re: Do you use LazyInitMode.AllowMultipleExecution?</title><link>http://blogs.msdn.com/b/pfxteam/archive/2009/04/03/9529966.aspx#9530761</link><pubDate>Fri, 03 Apr 2009 19:26:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9530761</guid><dc:creator>Jon Skeet</dc:creator><description>&lt;p&gt;I have no opinion at the moment about whether or not AllowMultipleExecution should be included (although the weird exception situation suggests not) but I just wanted to applaud the attitude being taken here:&lt;/p&gt;
&lt;p&gt;1) Designing an API carefully and trying to streamline it as much as possible (instead of &amp;quot;kitchen sink&amp;quot; syndrome).&lt;/p&gt;
&lt;p&gt;2) *Explaining* to the audience what the pros and cons of a particular decision might be.&lt;/p&gt;
&lt;p&gt;3) Asking the community for input.&lt;/p&gt;
&lt;p&gt;Bravo!&lt;/p&gt;
&lt;p&gt;Jon&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9530761" width="1" height="1"&gt;</description></item><item><title>re: Do you use LazyInitMode.AllowMultipleExecution?</title><link>http://blogs.msdn.com/b/pfxteam/archive/2009/04/03/9529966.aspx#9530676</link><pubDate>Fri, 03 Apr 2009 17:18:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9530676</guid><dc:creator>dimkaz</dc:creator><description>&lt;p&gt;I use the same technique as AllowMultipleExecution in a few places where I think the collision is unlikely but the code still needs to be thread safe.&lt;/p&gt;
&lt;p&gt;In general there is also a concern for the nested locks (deadlock).&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9530676" width="1" height="1"&gt;</description></item></channel></rss>