<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" media="screen" href="/App_Themes/default/rss.xslt"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:evnet="http://www.mscommunities.com/rssmodule/"><channel><title>Comment Feed for Jeffrey Richter and his AsyncEnumerator (Charles on Channel 9)</title><atom:link rel="self" type="application/rss+xml" href="http://channel9.msdn.com/posts/charles/jeffrey-richter-and-his-asyncenumerator/rss/default.aspx" /><image><url>http://mschnlnine.vo.llnwd.net/d1/Dev/App_Themes/C9/images/feedimage.png</url><title>Comment Feed for Jeffrey Richter and his AsyncEnumerator (Charles on Channel 9)</title><link>http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/</link></image><description>Jeffrey Richter and his AsyncEnumerator</description><link>http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/</link><language>en-us</language><pubDate>Mon, 19 Oct 2009 21:56:16 GMT</pubDate><lastBuildDate>Mon, 19 Oct 2009 21:56:16 GMT</lastBuildDate><generator>EvNet (EvNet, Version=1.0.3599.6114, Culture=neutral, PublicKeyToken=null)</generator><item><title>Re: Jeffrey Richter and his AsyncEnumerator</title><description>&lt;p&gt;This seems to be an implementation of trampoline-style threading in .Net. &lt;/p&gt;
&lt;p&gt;You write your code as a method which periodically gives up control of its calling thread by use of the "yield" statement. And you expect that the scheduler/engine will revive you so that you can continue from where you left off.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This same technique can be used to write multi-threaded programs in single-thread languages such as javascript:&amp;nbsp; &lt;a href="http://blogs.msdn.com/wesdyer/archive/2007/03/23/all-about-iterators.aspx"&gt;http://blog.monstuff.com/archives/000315.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This technique would benefit from C# supporting the "yield foreach" construction. This would allow for an iterator method calling into another iterator method passing the result directly through. This is an especially useful syntax and optimization for recusive calls (tree navigation).&lt;/p&gt;
&lt;p&gt;Read more on "yield foreach" at &lt;a href="http://blogs.msdn.com/wesdyer/archive/2007/03/23/all-about-iterators.aspx"&gt;http://blogs.msdn.com/wesdyer/archive/2007/03/23/all-about-iterators.aspx&lt;/a&gt;&lt;/p&gt;</description><comments></comments><link>http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=500152</link><pubDate>Mon, 19 Oct 2009 21:55:00 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=500152</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/500152/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>This seems to be an implementation of trampoline-style threading in .Net. 
You write your code as a method which periodically gives up control of its calling thread by use of the "yield" statement. And you expect that the scheduler/engine will revive you so that you can continue from where you left&amp;#8230;</evnet:previewtext><dc:creator>dumky</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/500152/Trackback.aspx</trackback:ping></item><item><title>Re: Re: Jeffrey Richter and his AsyncEnumerator</title><description>&lt;p&gt;Fixed. Thanks for letting us know!&lt;/p&gt;
&lt;p&gt;C&lt;/p&gt;</description><comments></comments><link>http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=480283</link><pubDate>Wed, 22 Jul 2009 15:32:26 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=480283</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/480283/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>Fixed. Thanks for letting us know!
C</evnet:previewtext><dc:creator>Charles</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/480283/Trackback.aspx</trackback:ping></item><item><title>Re: Jeffrey Richter and his AsyncEnumerator</title><description>&lt;p&gt;Hi Jeffrey,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I wanted to show your video about the AsyncEnumerator to a colleague, but it seems to have disappeared from Channel9...&lt;/p&gt;
&lt;p&gt;Was that a result of a conscious action, or did something go wrong? Is there any other place I can find it? - Peter&lt;/p&gt;</description><comments></comments><link>http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=480279</link><pubDate>Wed, 22 Jul 2009 13:58:02 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=480279</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/480279/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>Hi Jeffrey,
&amp;nbsp;
I wanted to show your video about the AsyncEnumerator to a colleague, but it seems to have disappeared from Channel9...
Was that a result of a conscious action, or did something go wrong? Is there any other place I can find it? - Peter</evnet:previewtext><dc:creator>Peter</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/480279/Trackback.aspx</trackback:ping></item><item><title>Re: Jeffrey Richter and his AsyncEnumerator</title><description>With the CCR going commercial, how does this fit. Seems like dirct competition. &lt;BR&gt;When would you use the CCR versus this?</description><comments></comments><link>http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=448554</link><pubDate>Mon, 15 Dec 2008 17:33:30 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=448554</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/448554/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>With the CCR going commercial, how does this fit. Seems like dirct competition. When would you use the CCR versus this?</evnet:previewtext><dc:creator>zinovate</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/448554/Trackback.aspx</trackback:ping></item><item><title>Re: Re: Re: Jeffrey Richter and his AsyncEnumerator</title><description>&lt;P&gt;Thank you my dear friend.&amp;nbsp;I like you and your books.............&lt;/P&gt;</description><comments></comments><link>http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=448398</link><pubDate>Sun, 14 Dec 2008 03:39:43 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=448398</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/448398/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>Thank you my dear friend.&amp;nbsp;I like you and your books.............</evnet:previewtext><dc:creator>QinShiChuan</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/448398/Trackback.aspx</trackback:ping></item><item><title>Re: Re: Re: Re: Re: Jeffrey Richter and his AsyncEnumerator</title><description>The use of C# iterators for aynchronous programming was first done by the CCR team. This is true. In fact, I remember thinking how outrageously cool it was to use C# iterators in this way. &lt;A target=_blank href="http://channel9.msdn.com/shows/Going+Deep/Concurrency-and-Coordination-Runtime/"&gt;Remember this interview&lt;/A&gt;? &lt;BR&gt;&lt;BR&gt;In this case, Jeff has extended on&amp;nbsp;the basic functionality present in CCR's implementation of async using C#&amp;nbsp;iterators to include some new and powerful capabilities. Great work, Jeff!&lt;BR&gt;&lt;BR&gt;C</description><comments></comments><link>http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=448103</link><pubDate>Fri, 12 Dec 2008 01:25:59 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=448103</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/448103/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>The use of C# iterators for aynchronous programming was first done by the CCR team. This is true. In fact, I remember thinking how outrageously cool it was to use C# iterators in this way. Remember this interview? In this case, Jeff has extended on&amp;nbsp;the basic functionality present in CCR's&amp;#8230;</evnet:previewtext><dc:creator>Charles</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/448103/Trackback.aspx</trackback:ping></item><item><title>Re: Re: Re: Re: Jeffrey Richter and his AsyncEnumerator</title><description>CCR has been using almost idenctical syntax to do what Jeff is showing here for about 4 years (publicly). Jeff was even in some of our videos 3 years ago.&lt;BR&gt;&lt;BR&gt;Various channel9 videos and PDC talk have examples...&amp;nbsp;&lt;BR&gt;&lt;A href="http://channel9.msdn.com/pdc2008/TL55/"&gt;http://channel9.msdn.com/pdc2008/TL55/&lt;/A&gt;&lt;BR&gt;&lt;BR&gt;&lt;A href="http://channel9.msdn.com/tags/CCR/"&gt;http://channel9.msdn.com/tags/CCR/&lt;/A&gt;&lt;BR&gt;&lt;BR&gt;CCR example for file read (from PDC session):&lt;BR&gt;&lt;BR&gt;
&lt;P&gt;IEnumerator&amp;lt;ITask&amp;gt; CcrReadFileAsync(string file)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var result = new Port&amp;lt;IAsyncResult&amp;gt;();&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; using (var fs = new FileStream(file,…,FileOptions.Asynchronous))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var buf = new byte[fs.Length];&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fs.BeginRead(buf, 0, buf.Length, result.Post, null);&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yield return result.Receive();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var ar = (IAsyncResult)resultPort.Test();&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try&amp;nbsp; {&amp;nbsp;&lt;BR&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fs.EndRead(ar);&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ProcessData(buf);&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;catch { // handle exception }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR&gt;} &lt;/P&gt;</description><comments></comments><link>http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=448099</link><pubDate>Fri, 12 Dec 2008 00:29:30 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=448099</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/448099/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>CCR has been using almost idenctical syntax to do what Jeff is showing here for about 4 years (publicly). Jeff was even in some of our videos 3 years ago.Various channel9 videos and PDC talk have examples...&amp;nbsp;http://channel9.msdn.com/pdc2008/TL55/http://channel9.msdn.com/tags/CCR/CCR example for&amp;#8230;</evnet:previewtext><dc:creator>georgioc</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/448099/Trackback.aspx</trackback:ping></item><item><title>Re: Jeffrey Richter and his AsyncEnumerator</title><description>Have you guys looked at my lirary, which I created in Mid 2006&lt;BR&gt;&lt;BR&gt;&lt;A title="Asynchronous Code Blocks" href="http://www.codeproject.com/KB/cs/AsynchronousCodeBlocks.aspx" target=_blank&gt;www.&lt;B&gt;code&lt;/B&gt;project.com/KB/cs/&lt;B&gt;AsynchronousCodeBlocks&lt;/B&gt;.aspx&lt;/A&gt;&lt;BR&gt;&lt;BR&gt;This library with my accompanying Managed IOCP library were very similar to Microsoft's Parallel FX and Task Library. I wrote these libraries in Mid 2005 through 2006.&lt;BR&gt;&lt;BR&gt;Regards,&lt;BR&gt;Aditya.P&lt;BR&gt;(Be Original)</description><comments></comments><link>http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=447911</link><pubDate>Wed, 10 Dec 2008 06:02:53 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=447911</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/447911/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>Have you guys looked at my lirary, which I created in Mid 2006www.codeproject.com/KB/cs/AsynchronousCodeBlocks.aspxThis library with my accompanying Managed IOCP library were very similar to Microsoft's Parallel FX and Task Library. I wrote these libraries in Mid 2005 through 2006.Regards,Aditya.P(Be Original)</evnet:previewtext><dc:creator>adityanand</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/447911/Trackback.aspx</trackback:ping></item><item><title>Re: Jeffrey Richter and his AsyncEnumerator</title><description>Just to say that I am a big fan of Jeff's work, and have been using his AsyncResult and AsyncEnumerator for some time, on a number of different projects.&amp;nbsp; I use the AE when loading WPF controls to make multiple asycn calls to a DB when fetching various bits of data that the control needs.&amp;nbsp; Subsequently the control loads up much more quickly, and when all of the data returns, I can update the control, all without having to use the Dispatcher.&lt;BR&gt;&lt;BR&gt;I do have one question though Jeff, you used to make the source code for your async library available on Wintellect, but now you only release a compiled library.&amp;nbsp; Why is this?&amp;nbsp; I have found that the latest release has caused a breaking change to my code, and so I am still using the version from May.&amp;nbsp; Can you at least outline what has changed between that version and Octobers release?&lt;BR&gt;&lt;BR&gt;Steve</description><comments></comments><link>http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=447825</link><pubDate>Tue, 09 Dec 2008 15:20:30 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=447825</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/447825/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>Just to say that I am a big fan of Jeff's work, and have been using his AsyncResult and AsyncEnumerator for some time, on a number of different projects.&amp;nbsp; I use the AE when loading WPF controls to make multiple asycn calls to a DB when fetching various bits of data that the control needs.&amp;nbsp;&amp;#8230;</evnet:previewtext><dc:creator>Steve Solomon</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/447825/Trackback.aspx</trackback:ping></item><item><title>Re: Jeffrey Richter and his AsyncEnumerator</title><description>Very clever idea Jeff. I got the feeling from the latest .NET framework that the APM model was being phased out by MS and replaced with the xxxAsync xxxCompleted event pattern. Just look at the code generated for WCF services for an example of this (even though I'm pretty sure it uses the APM pattern under the covers).&amp;nbsp; My only criticism of your AsyncEnumerator would be how large the iterator methods start to get when you have a fair bit of logic in each stage. As you said you can always switch back to separate event methods, but I'm wondering if there's not a happy medium somewhere in between, perhaps with sub-iterators, or some kind of iterator stack? Just thinking out loud...&lt;br&gt;</description><comments></comments><link>http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=447807</link><pubDate>Tue, 09 Dec 2008 12:19:53 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=447807</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/447807/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>Very clever idea Jeff. I got the feeling from the latest .NET framework that the APM model was being phased out by MS and replaced with the xxxAsync xxxCompleted event pattern. Just look at the code generated for WCF services for an example of this (even though I'm pretty sure it uses the APM&amp;#8230;</evnet:previewtext><dc:creator>Flatliner</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/447807/Trackback.aspx</trackback:ping></item><item><title>Re: Jeffrey Richter and his AsyncEnumerator</title><description>&lt;P&gt;I find this quite useful and it probably does make developing code faster in some circumstances. &lt;BR&gt;Thanks&amp;nbsp;Jeff&lt;BR&gt;&lt;/P&gt;</description><comments></comments><link>http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=447391</link><pubDate>Sat, 06 Dec 2008 21:20:03 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=447391</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/447391/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>I find this quite useful and it probably does make developing code faster in some circumstances. Thanks&amp;nbsp;Jeff</evnet:previewtext><dc:creator>nicholas22</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/447391/Trackback.aspx</trackback:ping></item><item><title>Re: Re: Re: Jeffrey Richter and his AsyncEnumerator</title><description>Hi Jeff&lt;br&gt;&lt;br&gt;Nice to hear from you!&amp;nbsp; Regarding Outlook, I agree that spawning 50
threads is way over the top. There's a difference, though, between consuming 50 threads for the life of the application and starting two threads that will run for a second.&lt;br&gt;&lt;br&gt;I wonder what Outlook is doing to consume that many threads. I never would have imagined that checking one's e-mail was that complicated!&lt;br&gt;&lt;br&gt;Cheers&lt;br&gt;&lt;br&gt;Joe&lt;br&gt;</description><comments></comments><link>http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=447326</link><pubDate>Sat, 06 Dec 2008 11:42:00 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=447326</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/447326/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>Hi JeffNice to hear from you!&amp;nbsp; Regarding Outlook, I agree that spawning 50
threads is way over the top. There's a difference, though, between consuming 50 threads for the life of the application and starting two threads that will run for a second.I wonder what Outlook is doing to consume that&amp;#8230;</evnet:previewtext><dc:creator>Joseph Albahari</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/447326/Trackback.aspx</trackback:ping></item><item><title>Re: Jeffrey Richter and his AsyncEnumerator</title><description>Very very nice. Hats off to Jeff for this.&lt;br&gt;</description><comments></comments><link>http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=447322</link><pubDate>Sat, 06 Dec 2008 10:02:27 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=447322</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/447322/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>Very very nice. Hats off to Jeff for this.</evnet:previewtext><dc:creator>StrongCoffee</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/447322/Trackback.aspx</trackback:ping></item><item><title>Re: Re: Jeffrey Richter and his AsyncEnumerator</title><description>&lt;DIV&gt;I certainly agree with your comments about server-side code. However, I disagree with your thoughts about client-side code. On my machine Outlook (just to pick some app as an example) has over 50 threads in it because the Outlook developers have the mindset that it isn't bad to just spawn off a few more threads and allocate a few more megabytes of memory. However, this wastes a lot of resources and if Outlook is running on a terminal server machine hosting 100 client sessions, then that means 5,000 threads on the system! In fact, because this problem is so bad, Windows 7 is doing a lot to reduce the number of threads used throughout system services and applications that ship with the OS so that Windows 7 will run well on small footprint machines with only 1GB of RAM in them. Clearly the Windows team feels that all the threads they have been creating has been hurting them and they are finally doing something about it.&lt;BR&gt;&lt;BR&gt;And, since I'd like to make things better for Windows users,&amp;nbsp; I highly recommend asynchrounous programming for client-side applications. Also,&amp;nbsp;delegates DO support the APM via their BeginInvoke/EndInvoke methods and because of this, asynchronous delegate invocations integrate quite nicely with my AsyncEnumerator. In addition, my AsyncEnumerator automatically marshals the result back to the GUI thread so there is no need to call Control's BeginInvoke method (for Windows Forms) or DispatcherObject's BeginIvoke method (for&amp;nbsp;WPF). Furthermore, my AE offers cancelation/timeout support&amp;nbsp;as well as discard support which are all useful features for client-side applications that you do not get with the APM alone or by just spawning up another thread.&lt;BR&gt;&lt;BR&gt;ASP.NET does support the ability for developers to implement their web form or web service app asynchronously but few developers take advantage of this. However, ASP.NET offers it as an option because it does not simply give it to you by default. Also, it is very useful to perform async programming when accessing a DB because the DB &lt;EM&gt;IS &lt;/EM&gt;a bottleneck (as you point out). If you make synchronous requests to a DB then your server will create a ton of threads which are all blocked; your server will handle just a few concurrent requests and memory consumption will be very high with thread stacks which your code is not using at all. &lt;BR&gt;&lt;BR&gt;In the real world, there are many developers&amp;nbsp;who will avoid high-level synchronous libraries in order to gain scalability. I know that MS does avoid synchronous DB access for Hotmail and many of its other highly-scalable services. However, it is true, that if your service has few concurrent users, then you do get a lot of benefit from various synchronous abstractions (like Linq to SQL). In an ideal world, these abstractions that offer such productivity will offer asynchronous ways of using them. Linq to SQL doesn't offer this today but it could in the future (or Linq to Entities could).&lt;BR&gt;&lt;BR&gt;And, as for refactoring...Iterators do offer some challenges here, I agree. However, from an iterator, you can call compute-bound synchronous methods or methods that initiate an asynchronous compute-bound or I/O-bound operation that itself returns an IAsyncResult. And, also my AsyncEnumerator does support composition where an iterator can invoke another iterator. For example, you could create an iterator that asynchronously queries a web server to get some data and process it. And then, you can create another iterator that consumes the first in a loop to do asynchronous processing for several web sites. In fact, all of this processing can happen concurrently allowing for phenominal scaling. If your iterator methods get overwhelming, then you can resort to call back methods which is what all native applications have to do and what developers writing scalable managed application have to do today. Iterators give you a new ability; they don't take away any of the old abilities. This ability has very few drawbacks but if you come across one, then don't use it; go back to an older tried and true way.&lt;/DIV&gt;</description><comments></comments><link>http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=447292</link><pubDate>Sat, 06 Dec 2008 04:05:59 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=447292</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/447292/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>I certainly agree with your comments about server-side code. However, I disagree with your thoughts about client-side code. On my machine Outlook (just to pick some app as an example) has over 50 threads in it because the Outlook developers have the mindset that it isn't bad to just spawn off a few&amp;#8230;</evnet:previewtext><dc:creator>Jeffrey Richter</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/447292/Trackback.aspx</trackback:ping></item><item><title>Re: Jeffrey Richter and his AsyncEnumerator</title><description>&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;Regarding the difference between this and PFX, they are solving different problems. PFX is about providing simple means of parallel execution; Jeff's library is about maximizing thread efficiency by avoiding thread blocking altogether by following the APM model. APM is a requirement when writing programs that:&lt;br&gt;(1) have potentially hundreds or thousands of parallel execution paths&lt;br&gt;(2) spend most of their time blocking&lt;br&gt;Without (1), you won't gain enough through the APM to justify the extra programming effort. Without (2), you won't save anything with the APM. The quintessential application is a sockets server that accepts requests over the net. Because the Internet is slow, requests may take many seconds from end to end, and yet spend most of their time blocked waiting on a slow network. A well-written asynchronous TCP server can handle a thousand concurrent requests while consuming just a few threads.&lt;br&gt;&lt;br&gt;APM relies on methods returning with a callback rather than blocking the underlying thread. There are actually fairly few truely asycnhronous methods in the .NET Framework - most are related to networking, where the most gains are to be had.&lt;br&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Jeff's idea is&amp;nbsp;very clever - but&amp;nbsp;it's dubious&amp;nbsp;using it for retrieving 
web pages in the background in a Win Forms application. The only thing&amp;nbsp;he's 
achieving is saving the overhead of&amp;nbsp;tying up&amp;nbsp;one or two&amp;nbsp;threads for a few 
seconds. There was a time when tying up 1MB of memory for a few seconds was a 
big deal, but those days are long gone. Using PFX (or asynchronous delegates, which interestingly don't follow the APM) would be simpler and just as effective.&lt;br&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;By far, the most common use for the async-callback-method model is writing a&amp;nbsp;TCP or HTTP server capable of handling&amp;nbsp;hundreds of concurrent 
requests.&amp;nbsp;It's NOT required within ASP.NET apps because the ASP.NET 
infrastructure already does this for you. It's also not needed&amp;nbsp;around making 
database calls within a web app because the DB server will nearly always be more 
of a bottleneck than&amp;nbsp;the accompanying&amp;nbsp;thread overhead. And who in real life 
would&amp;nbsp;give up the productivity of&amp;nbsp;the high-level synchronous DB libraries such as 
LINQ to SQL and revert to using low-level async-compliant SqlCommand objects and 
the like?&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;So if you were writing a large TCP or HTTP server from scratch yourself, Jeff's library may be very helpful. The only problem I can see (unless I'm mistaken) is that you can't&amp;nbsp;refactor 
iterator methods into smaller chunks - as its complexity grows, the method will 
get bigger and bigger and there's nothing you can do about it.&amp;nbsp;The problem is 
that&amp;nbsp;any methods&amp;nbsp;that you call from an iterator can't themselves yield on&amp;nbsp;behalf 
of the caller. So if you wanted to do this:&lt;br&gt;&lt;br&gt;foreach (var foo in far)&lt;br&gt;&amp;nbsp;&amp;nbsp; AnotherMethod (foo);&lt;br&gt;&lt;br&gt;then AnotherMethod couldn't do anything asynchronous within its implementation.&lt;br&gt;&lt;br&gt;Joe&lt;br&gt;&lt;/div&gt;</description><comments></comments><link>http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=447278</link><pubDate>Sat, 06 Dec 2008 01:23:05 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=447278</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/447278/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>&amp;nbsp;&amp;nbsp;Regarding the difference between this and PFX, they are solving different problems. PFX is about providing simple means of parallel execution; Jeff's library is about maximizing thread efficiency by avoiding thread blocking altogether by following the APM model. APM is a requirement when&amp;#8230;</evnet:previewtext><dc:creator>Joseph Albahari</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/447278/Trackback.aspx</trackback:ping></item><item><title>Re: Jeffrey Richter and his AsyncEnumerator</title><description>Here's what I mean:&lt;A href="http://incrediblejourneysintotheknown.blogspot.com/"&gt;&lt;BR&gt;&lt;BR&gt;&lt;/A&gt;&lt;A href="http://incrediblejourneysintotheknown.blogspot.com/2008/12/asynchronous-sockets-with-yield-return.html"&gt;http://incrediblejourneysintotheknown.blogspot.com/2008/12/asynchronous-sockets-with-yield-return.html&lt;/A&gt;&lt;BR&gt;&lt;BR&gt;Would be very interested to hear what Jeffrey thinks about it!</description><comments></comments><link>http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=447182</link><pubDate>Fri, 05 Dec 2008 14:18:24 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=447182</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/447182/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>Here's what I mean:http://incrediblejourneysintotheknown.blogspot.com/2008/12/asynchronous-sockets-with-yield-return.htmlWould be very interested to hear what Jeffrey thinks about it!</evnet:previewtext><dc:creator>Daniel Earwicker</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/447182/Trackback.aspx</trackback:ping></item><item><title>Re: Jeffrey Richter and his AsyncEnumerator</title><description>Couldn't the function use yield return to hand back a lambda, and the lambda would contain the asynchronous call(s) to fire off?&lt;BR&gt;&lt;BR&gt;The calls could be made on an interface that wraps the socket and hides the details of managing the asynchronous nature of the call altogether.&lt;BR&gt;&lt;BR&gt;Hmm... this sounds like a good idea... I'll whip up something to demonstrate what I mean more clearly.</description><comments></comments><link>http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=447169</link><pubDate>Fri, 05 Dec 2008 13:24:44 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=447169</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/447169/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>Couldn't the function use yield return to hand back a lambda, and the lambda would contain the asynchronous call(s) to fire off?The calls could be made on an interface that wraps the socket and hides the details of managing the asynchronous nature of the call altogether.Hmm... this sounds like a&amp;#8230;</evnet:previewtext><dc:creator>Daniel Earwicker</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/447169/Trackback.aspx</trackback:ping></item><item><title>Re: Jeffrey Richter and his AsyncEnumerator</title><description>You guys should look at asynchronous workflows in F#, here is a Channel9 video on it:&lt;BR&gt;&lt;BR&gt;&lt;A href="http://channel9.msdn.com/posts/Charles/Don-Syme-Whats-new-in-F-Asynchronous-Workflows-and-welcome-to-the-NET-family/"&gt;http://channel9.msdn.com/posts/Charles/Don-Syme-Whats-new-in-F-Asynchronous-Workflows-and-welcome-to-the-NET-family/&lt;/A&gt;&lt;BR&gt;&lt;BR&gt;Asynchronous workflows allow you to express asynchronous computations without having to wrap their continuations.</description><comments></comments><link>http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=447102</link><pubDate>Fri, 05 Dec 2008 01:21:07 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=447102</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/447102/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>You guys should look at asynchronous workflows in F#, here is a Channel9 video on it:http://channel9.msdn.com/posts/Charles/Don-Syme-Whats-new-in-F-Asynchronous-Workflows-and-welcome-to-the-NET-family/Asynchronous workflows allow you to express asynchronous computations without having to wrap their continuations.</evnet:previewtext><dc:creator>Adam Granicz</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/447102/Trackback.aspx</trackback:ping></item><item><title>Re: Re: Jeffrey Richter and his AsyncEnumerator</title><description>They are very different. Parallel.For in particular is about performing a bunch of compute-bound operations in parallel scaling out across all the CPUs in teh machine. My AsyncEnumerator is mostly about issuing one or more concurrent I/O-bound operations without have any threads block for them to complete.</description><comments></comments><link>http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=447088</link><pubDate>Thu, 04 Dec 2008 22:27:20 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=447088</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/447088/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>They are very different. Parallel.For in particular is about performing a bunch of compute-bound operations in parallel scaling out across all the CPUs in teh machine. My AsyncEnumerator is mostly about issuing one or more concurrent I/O-bound operations without have any threads block for them to complete.</evnet:previewtext><dc:creator>Jeffrey Richter</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/447088/Trackback.aspx</trackback:ping></item><item><title>Re: Re: Jeffrey Richter and his AsyncEnumerator</title><description>Differences with Parallel.For? One that springs to mind is that an application on&amp;nbsp;current or myabe not-so current&amp;nbsp;.NET technology can leverage this technique.&lt;BR&gt;&lt;BR&gt;Top marks,&amp;nbsp;Jeff.</description><comments></comments><link>http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=447064</link><pubDate>Thu, 04 Dec 2008 19:58:46 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=447064</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/447064/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>Differences with Parallel.For? One that springs to mind is that an application on&amp;nbsp;current or myabe not-so current&amp;nbsp;.NET technology can leverage this technique.Top marks,&amp;nbsp;Jeff.</evnet:previewtext><dc:creator>Luke Puplett</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/447064/Trackback.aspx</trackback:ping></item><item><title>Re: Jeffrey Richter and his AsyncEnumerator</title><description>This library seems interesting. Can someone comment on similarities/differences to the Parallel.For library?&lt;br&gt;&lt;br&gt;IIRC, there's no cancelling nor timeout mechanism in Parallel.For, but is that all?&lt;br&gt;</description><comments></comments><link>http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=446909</link><pubDate>Thu, 04 Dec 2008 03:22:57 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/?CommentID=446909</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/446909/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>This library seems interesting. Can someone comment on similarities/differences to the Parallel.For library?IIRC, there's no cancelling nor timeout mechanism in Parallel.For, but is that all?</evnet:previewtext><dc:creator>Minh</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/446909/Trackback.aspx</trackback:ping></item></channel></rss>