mirror of
https://github.com/ocaml-multicore/eio.git
synced 2025-08-23 00:01:45 -04:00
Clarify purpose of epoll FD test
This commit is contained in:
parent
eab55876f3
commit
4cc9e1360e
@ -6,7 +6,10 @@
|
||||
open Eio.Std
|
||||
```
|
||||
|
||||
## Closing an FD removes it from epoll
|
||||
## Closing an FD removes it from the multiplexer
|
||||
|
||||
Closing an FD automatically removes it from epoll's set, meaning that you have
|
||||
to re-add it using `EPOLL_CTL_ADD`, not `EPOLL_CTL_MOD`.
|
||||
|
||||
```ocaml
|
||||
# Eio_posix.run @@ fun _env ->
|
||||
@ -14,6 +17,8 @@ open Eio.Std
|
||||
let r, w = Eio_unix.pipe sw in
|
||||
Eio_unix.await_writable (Eio_unix.FD.peek w)
|
||||
);
|
||||
(* [r] and [w] are now closed. We'll likely allocate the same FD numbers the second time.
|
||||
Check we don't get confused and try to [EPOLL_CTL_MOD] them. *)
|
||||
Switch.run (fun sw ->
|
||||
let r, w = Eio_unix.pipe sw in
|
||||
Eio_unix.await_writable (Eio_unix.FD.peek w)
|
||||
|
Loading…
x
Reference in New Issue
Block a user