Eio.Fiber.both f g
runs f
and g
concurrently in the context of the Eio scheduler (I think?). What you want is some both_inplace f g
that runs f
and g
in the context where both_inplace
was called.
I don’t think anything fundamentally prevents this, I think a simple local overriding of Yield
would work:
let finish f =
ignore @@
deep_handle f () with
| Yield (), k -> k ()
let rec both_inplace f g =
ignore @@
shallow_handle f () with
| Yield (), k -> both_inplace g k
| return v -> finish g
Of course that is the most basic local scheduler possible, Eio would probably want something more involved that adds the two threads into the thread’s pool, it’s just not implemented.