-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
I have a case in #119 where I'm in a coroutine and want to call another coroutine, but with a different continuation. So something like this:
import haxe.coro.CoroIntrinsics;
import hxcoro.Coro.*;
import hxcoro.CoroRun;
import hxcoro.concurrent.CoroLatch;
import hxcoro.continuations.FunctionContinuation;
function main() {
@:coroutine function g() {
trace("g()");
yield();
}
@:coroutine function f() {
trace("f()");
final latch = new CoroLatch(1);
final myCont = new FunctionContinuation(CoroIntrinsics.getContext(), (_, _) -> {
trace("Called!");
latch.arrive(1);
});
// workaround
(() -> g(myCont))();
latch.wait();
}
CoroRun.run(f);
}This works, but I wonder if there should be a more obvious way of doing this.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels