Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add run_lwt and handle cancellation #8

Merged
merged 2 commits into from
Jun 13, 2022
Merged

Conversation

talex5
Copy link
Collaborator

@talex5 talex5 commented Jun 13, 2022

  • run_lwt waits for an Lwt promise, and also cancels it if the Eio fiber is cancelled.
  • run_eio cancels the Eio fiber if the Lwt promise is cancelled.

Nothing special needs to be done to run Lwt code from Eio, but having
this makes it consistent with the other combinations and avoids having
to remember which way is safe.
@talex5 talex5 changed the title Add run_lwt for consistency with run_eio and Async_eio Add run_lwt and handle cancellation Jun 13, 2022
@talex5 talex5 force-pushed the run_lwt branch 2 times, most recently from b3b472b to 209c189 Compare June 13, 2022 10:30
- Cancelling a `run_lwt` Fiber cancels the Lwt promise.
- Cancelling a `run_eio` promise cancels the Eio fiber.
@talex5 talex5 merged commit 2df6097 into ocaml-multicore:master Jun 13, 2022
@talex5 talex5 deleted the run_lwt branch June 13, 2022 10:42
talex5 added a commit to talex5/opam-repository that referenced this pull request Jun 21, 2022
CHANGES:

- Add some tests and documentation of the internals (@talex5 ocaml-multicore/lwt_eio#9).

- Bridge Eio and Lwt cancellation (@talex5 ocaml-multicore/lwt_eio#8).
  - Cancelling a `run_lwt` Fiber cancels the Lwt promise.
  - Cancelling a `run_eio` promise cancels the Eio fiber.

- Add `run_lwt` for consistency with `run_eio` and Async_eio (@talex5 ocaml-multicore/lwt_eio#8).

- Add `Lwt_eio.Token.t` token to ensure library is initialised (@talex5 ocaml-multicore/lwt_eio#5).
  `with_event_loop` now passes a `Lwt_eio.Token.t` to its callback.

- Update to Eio 0.2 (@talex5 ocaml-multicore/lwt_eio#4).
  Eio 0.2 renamed "fibre" to "fiber". This fixes the deprecation warning.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant