LE:关于死机问题看到这些开放的错误:Bug 566324,Bug 580791,Bug 602502
我是相当新的这个我自己,我在这里我迄今收集的信息。也许它会有用。 1)Mono.Tasklets库(由Miguel de Icaza描述[阅读:here])是一个连续库,可用于构造各种形式的连续系统和轻量级(LW)线程。
一个简单的方法来描述这是C的longjmp/setjmp的单语版本,它们只能用于展开堆栈。
库最初是由一个人开发的[阅读:here]现在它包含在单和记录[阅读:here(跟随这些链接,你会发现更多的信息)
那家伙实施在这个抽象之上的微线程库。现在已移植到Mono.Tasklets框架
2)continuation是一个对象,可用于存储当前的执行状态,然后可用于稍后恢复存储的状态。
此处的“执行状态”表示堆栈,其中包括调用堆栈和局部变量以及处理器的寄存器。
当存储状态恢复时,程序执行看起来像跳回到保存状态的位置,并恢复所有局部变量。上Wikipedia/Continuations
3)API
An example in C.等详细信息是:
public class Continuation {
public Continuation();
public void Mark();
public int Store (int state);
public void Restore (int state);
}
延续可用于实现微螺纹。你可以看看Mono的代码。在Github上可用的微螺纹[READ:here]
public Continuation()
{
m_handle = alloc_continuation();
Print("Continuation()");
}
public void Mark()
{
Print("Mark()");
// skip 1 frame, ie. this function
mark_continuation_frame(m_handle, 1);
}
public int Store(int data)
{
Print("Store({0})", data);
int res = store_continuation(m_handle, data);
Print("Store({0}) = {1}", data, res);
return res;
}
public void Restore(int data)
{
Print("Restore({0})", data);
restore_continuation(m_handle, data);
Print("Restore() exit (NEVER REACHED)");
}
从呈现什么here:
马克()它用于标记的最顶层帧被存储
Store(x)将当前状态存储到继续,并返回给定的整数x。
还原(y)恢复存储的状态,并返回给定的整数y。 (注意:给恢复整数y实际上是从商店()方法返回,因为这是我们的状态有所恢复后)。
static void Main()
{
Continuation c = new Continuation();
c.Mark();
int foo = 123;
int val = c.Store(0);
Console.WriteLine("{0} {1}", val, foo);
foo = 321;
if (val < 5)
c.Restore(val + 1);
}
当你调用存储()的当前状态执行被记录下来并且可以通过调用Restore()返回到这个状态。
呼叫者存储()告诉它是否是基于结果从存储初始存储或还原点:
var c = new Continuation();
...
switch (c.Store (0)){
case 0:
// First invocation
case 1:
// Restored from the point ahead.
}
...
// Jump back to the switch statement.
c.Restore (1);
的monoco链接+特别是你的总结是极其有帮助 - 谢谢! – 2010-07-26 15:50:05