C# 中有类似 Stackless Python 的东西吗?
有没有类似Stackless Python的东西,即支持C#中的延续、微线程和轻量级进程的框架?我知道 C# 5 将部分支持其中一些功能。但现在有什么可以用的吗?
Is there something similar to Stackless Python, i.e. a framework that supports continuations, microthreads and lightweight processes in C#? I know that C# 5 is going to support partially some of these features. But is there anything that can be used right now?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Axum 类似,但已作为 Microsoft 项目正式删除:
http://msdn。 microsoft.com/en-us/devlabs/dd795202
我有一篇博客文章,展示了工作中的基本协同例程:
http://adamhouldsworth.blogspot.com/2009/05/microsoft-axum-playtime .html
我不知道这些想法是否已被推广到 .NET 4 中的并行工作或预定的
async
内容中接下来是 C#。它现在可以使用,并且可以工作 - 但在一些小区域中功能不完整,并且在生产环境中不受支持,因为它是(曾经?)一个孵化项目。
在 CodeProject 上查看此内容(它可能会满足您的“轻量级流程”要求):
http: //www.codeproject.com/KB/cs/managementiocp.aspx
更新:此链接描述了 TPL 数据流,向 .NET 框架添加了更多原语以支持基于代理编程。它可能又位于您感兴趣的区域:
http ://blogs.msdn.com/b/pfxteam/archive/2010/10/28/10081950.aspx
Axum is similar, but has been officially dropped as a project from Microsoft:
http://msdn.microsoft.com/en-us/devlabs/dd795202
I've got a blog post showing a basic co-routine at work:
http://adamhouldsworth.blogspot.com/2009/05/microsoft-axum-playtime.html
I have no idea if any of those ideas have been pushed across to the parallel work that went into .NET 4 or the
async
stuff slated for C# next.It can be used right now, and works - but is feature incomplete in some small areas and not supported in a production environment as it's (was?) an incubation project.
Take a look at this on CodeProject (it may address your "lightweight process" requirement):
http://www.codeproject.com/KB/cs/managediocp.aspx
Update: this link describes TPL Data Flow, more primitives added to the .NET framework in order to support agent-based programming. It again might be in the area you are interested in:
http://blogs.msdn.com/b/pfxteam/archive/2010/10/28/10081950.aspx
我对这个问题的回答可能会帮助您入门。我使用迭代器方法 (
yield return
) 来实现一个简单的协程,以便在 WPF 中发生一系列动画。该序列将能够使用任何类型的循环等。这实际上只使用了 C# 2.0 功能。My answer to this question may get you started. I use an iterator method (
yield return
) to implement a simple coroutine so that a sequence of animations takes place in WPF. The sequence would be able to use any kind of looping, etc. That was really only using C# 2.0 features.您是指 .NET 框架的并行扩展 PLINQ 之类的东西吗?
AFAIK C# 中的枚举器块很像延续,但我不是 python 专家。
You mean something like the parallel extensions PLINQ of the .NET framework?
AFAIK enumerator blocks in C# are much like continuations, but Iam no expert for python.