简体   繁体   English

API 设计中的 c# 5 等待/异步模式

[英]c# 5 await/async pattern in API design

How can the c# 5 await/async pattern boost the expressiveness of new APIs that deals with coroutines (as Jon Skeet shows in recent posts), or with the actor model? c# 5 等待/异步模式如何提高处理协程(如 Jon Skeet 在最近的帖子中所示)或演员 model 的新 API 的表现力?

As you mentioned, Jon Skeet's has been discussing Coroutines using the Async CTP , so I will skip that portion of your question...正如你所提到的,Jon Skeet 一直在讨论使用 Async CTP 的 Coroutines ,所以我将跳过你问题的那一部分......

The actor model is actually being addressed in the Async CTP via TPL Dataflow .演员 model 实际上是通过TPL Dataflow在 Async CTP 中处理的。 This is a new library using the Task classes which allows for a form of the Actor model as well as many other data flow and similar scenarios.这是一个使用Task类的新库,它允许 Actor model 以及许多其他数据流和类似场景的形式。 Since it's based around the Task and Task<T> classes, it also integrates perfectly with await / async very nicely.由于它基于TaskTask<T>类,因此它还可以很好地与await / async完美集成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM