Skip to content

Commit

Permalink
Add a warning to the tutorial about Fiber.first
Browse files Browse the repository at this point in the history
  • Loading branch information
talex5 committed Dec 17, 2022
1 parent 56ea1cd commit 189961b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,11 @@ If you want to make an operation non-cancellable, wrap it with `Cancel.protect`
- : unit = ()
```

Note: using `Fiber.first` to ensure that *exactly one* of two actions is performed is not reliable.
There is usually a possibility that both actions succeed at the same time (and one result is thrown away).
For example, if you ask Eio read from two sockets with `io_uring`
then the kernel may have already performed both reads by the time it tells Eio about the first one.

## Switches

A [switch][Eio.Switch] is used to group fibers together, so they can be waited on together.
Expand Down

0 comments on commit 189961b

Please sign in to comment.