Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Compile and run the program below with
- ```
- ocamlfind opt -linkpkg -package lwt.unix foo.ml && ./a.out
- ```
- As written with `Lwt.pick`, `p2` is canceled first, its callback (registered by `Lwt.catch`) runs first, and the output is
- ```
- p2's callback sees p3 pending
- p3's callback sees p2 failed
- ```
- If changed to have `Lwt.npick` from the PR, `p3` is completed first, its callback (registered by `Lwt.bind`) runs first, and the output is
- ```
- p3's callback sees p2 pending
- p2's callback sees p3 resolved
- ```
- Ideally, changing `pick` to `npick` shouldn't produce this difference in callback execution order and seen states, as it makes refactoring relatively more dangerous.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement