private static IEnumerator Recurse2(IoCoroutine f) { //yield return null; // just create and quit // 1 //f.fiber.Yield(f); IoCoroutine ccc = IoCoroutine.createObject(IoCLI.state); ccc.fiber = new Fiber(); ccc.fiber.currentCoro = ccc; //yield return ccc.fiber.currentRoutine = new FiberProc(IoCLI.Recurse3 /*(ccc)*/); if (coro.fiber.State == 4) { Console.WriteLine("Creation Error. Fiber Exceeds on Recurse 2 " + f.uniqueId); IoCLI.yieldingCoros.Remove(f); return(null); } ccc.rawSetResult(IoNumber.newWithDouble(IoCLI.state, 42)); ccc.rawSetRunLocals(IoCLI.state.core); ccc.rawSetRunMessage(IoCLI.state.nilMessage); ccc.rawSetRunTarget(ccc); IoCLI.yieldingCoros.Add(ccc); //Console.WriteLine("Coro2 " + f.uniqueId + " creates Coro3 + " + ccc.uniqueId); IoCLI.yieldingCoros.Remove(f); //yield return null; // 2 return(null); }
private static IEnumerator Recurse3(IoCoroutine f) { IoCoroutine ccc = IoCoroutine.createObject(IoCLI.state); ccc.fiber = new Fiber(); ccc.fiber.currentCoro = ccc; ccc.fiber.currentRoutine = IoCLI.Recurse4(ccc); ccc.rawSetResult(IoNumber.newWithDouble(IoCLI.state, 42)); ccc.rawSetRunLocals(IoCLI.state.core); ccc.rawSetRunMessage(IoCLI.state.nilMessage); ccc.rawSetRunTarget(ccc); IoCLI.yieldingCoros.Add(ccc); Console.WriteLine("Recurse3+" + i++); yield return(ccc); }
private static IEnumerator Recurse2(IoCoroutine f) { yield return(null); // just create and quit IoCoroutine ccc = IoCoroutine.createObject(IoCLI.state); ccc.fiber = new Fiber(); ccc.fiber.currentCoro = ccc; ccc.fiber.currentRoutine = IoCLI.Recurse3(ccc); ccc.rawSetResult(IoNumber.newWithDouble(IoCLI.state, 42)); ccc.rawSetRunLocals(IoCLI.state.core); ccc.rawSetRunMessage(IoCLI.state.nilMessage); ccc.rawSetRunTarget(ccc); IoCLI.yieldingCoros.Add(ccc); yield return(ccc); }
private static IEnumerator Recurse3(IoCoroutine f) { int i = 0; IoCoroutine ccc = IoCoroutine.createObject(IoCLI.state); ccc.fiber = new Fiber(); ccc.fiber.currentCoro = ccc; //yield return ccc.fiber.currentRoutine = new FiberProc(IoCLI.Recurse4 /*(ccc)*/); if (coro.fiber.State == 4) { Console.WriteLine("Creation Error. Fiber Exceeds on Recurse 3 " + f.uniqueId); IoCLI.yieldingCoros.Remove(f); return(null); } ccc.rawSetResult(IoNumber.newWithDouble(IoCLI.state, 42)); ccc.rawSetRunLocals(IoCLI.state.core); ccc.rawSetRunMessage(IoCLI.state.nilMessage); ccc.rawSetRunTarget(ccc); IoCLI.yieldingCoros.Add(ccc); IoCLI.yieldingCorosCount++; //Console.WriteLine("Coro3 " + f.uniqueId + " creates Coro4 + " + ccc.uniqueId); while (i < 2) { // f.fiber.Yield(f); //Console.WriteLine("Recurse3 Fiber: " + f.uniqueId + " Iteration: " + i++); //yield return null; i++; } IoCLI.yieldingCoros.Remove(f); return(null); }