求高手答疑! ------最佳解决方案-------------------- 最适合状态机实现了:
private volatile string state = "idle";
private AutoResetEvent are = new AutoResetEvent(false);
public void Loop()
{
while (true)
{
switch (state)
{
case "idle":
are.WaitOne(-1, false);
state = "doother";
break;
case "doother":
// call fun();
state = "idle";
break;