Coroutine and Actor model
Unity3D中C#实现协程需要注意一下几点:
# An iterator member's signature cannot contain any out or ref parameters.
# An iterator cannot contain a return statement .
# An iterator may not contain any unsafe code.
# A finally block may not contain a yield return or a yield break statement.
# A yield return statement may not appear in a try block that has a catch block.
# A yield return statement may not appear in a catch block (yield break is OK)
解答这点的原因:
Iterator Blocks, Part Two: Why no ref or out parameters?
Iterator Blocks, Part Three: Why no yield in finally?
Iterator Blocks, Part Four: Why no yield in catch?
Iterator Blocks, Part Five: Push vs Pull
Iterator Blocks, Part Six: Why no unsafe code?
Iterator Blocks, Part Seven: Why no anonymous iterators?
参考文献:
Coroutine: http://en.wikipedia.org/wiki/Coroutine
Actor model: http://en.wikipedia.org/wiki/Actor_model
Microsoft Asynchronous Agents Library: http://msdn.microsoft.com/en-us/library/dd492627.aspx
Unity3D - Coroutines & Yield: http://docs.unity3d.com/Documentation/ScriptReference/index.Coroutines_26_Yield.html
Coroutine实现有感:http://www.douban.com/note/11552969/
浅谈 C# 中的代码协同 (Coroutine) 执行支持:http://www.cnblogs.com/flier/archive/2004/08/20/35021.html