ocaml-multicore / eio

Effects-based direct-style IO for multicore OCaml
Other
548 stars 66 forks source link

Safe Fiber races: `~combine` and `Fiber.n_any` #587

Closed SGrondin closed 8 months ago

SGrondin commented 1 year ago

Addresses #558

I originally tried a much more complex approach before realizing the obvious one is probably good enough.

I tried to validate that this solution is sufficient by reading how fibers work internally, but I wouldn't be surprised if I missed some important detail.

The user-facing API turned out quite nice, in my opinion. Thanks for the suggestion in #558 @talex5

This PR is a prerequisite for #584

SGrondin commented 10 months ago

@talex5 Even though this is not needed for the Executor_pool anymore, I still think it should be considered for merging. I have Lwt programs that cannot be converted to Eio without it.