Async CTP and timeouts

I started watching Jon Skeet's presentation on C# Async CTP. He stuttered when it came to specifying timeouts.

Coming from fairly limited exposure to F#, there is an intuitive, centralized, and simple way to specify timeouts. So, I am wondering what is the current state of affairs: can C# Async CTP do all the things that F# async block runner does? Is there a document that outlines differences and limitations?


Additional details: In F#, the async block runner provides a way to specify the following:

  • Exception flow
  • Timeout flow
  • Cancellation flow
  • Extensibility to the above three features
  • Here's a way to do these things in F#: Order of arguments and pipe-right operator


    I don't even remember mentioning timeouts - but I'll take your word for it :)

    It's fairly easy to compose tasks to achieve a timeout: create a second task which is a "delay", and then wait for either that or the original task to complete. Whichever one gets there first, cancel the other if feasible (with a cancellation token). The newly created task will complete with either the result of the main operation (if that succeeded) or an exception if the "delay" finished first.

    I don't see anything like that directly supported in AsyncCtpLibrary.dll, but you can build it reasonably easily from the tools which are provided. You may want to look in the "Task-Based Asynchronous Pattern Overview" and "TPL Dataflow" documents to see if they cover it, too.

    链接地址: http://www.djcxy.com/p/6716.html

    上一篇: json包含条件

    下一篇: 异步CTP和超时