Is there something similar to Stackless Python, i.e. a framework that supports continuations, microthreads an开发者_JAVA技巧d 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?
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
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.
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.
精彩评论