package eio
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=c4222f9b081465486a1c1a8dde6aa00178936d7c7b3a8565e0883a421e0e3547
sha512=d63d8b9500b492be93df4f29159aa6955588ca1e35e6a5817856e32ee4fec3395604dc7b64fc5a973ee8bd436bd65831e7b08fca9bf909f41afec4a65c4443b8
doc/eio.unix/Eio_unix/index.html
Module Eio_unixSource
Extension of Eio for integration with OCaml's Unix module.
Note that OCaml's Unix module is not safe, and therefore care must be taken when using these functions. For example, it is possible to leak file descriptors this way, or to use them after they've been closed, allowing one module to corrupt a file belonging to an unrelated module.
await_readable fd blocks until fd is readable (or has an error).
await_writable fd blocks until fd is writable (or has an error).
sleep d sleeps for d seconds, allowing other fibers to run. This is can be useful for debugging (e.g. to introduce delays to trigger a race condition) without having to plumb Eio.Stdenv.mono_clock through your code. It can also be used in programs that don't care about tracking determinism.
run_in_systhread fn runs the function fn in a newly created system thread (a Thread.t). This allows blocking calls to be made non-blocking.
val socketpair :
sw:Eio.Std.Switch.t ->
?domain:Unix.socket_domain ->
?ty:Unix.socket_type ->
?protocol:int ->
unit ->
socket * socketsocketpair ~sw () returns a connected pair of flows, such that writes to one can be read by the other. This creates OS-level resources using socketpair(2). Note that, like all FDs created by Eio, they are both marked as close-on-exec by default.
val pipe :
Eio.Std.Switch.t ->
< Eio.Flow.source
; Eio.Flow.close
; unix_fd >
* < Eio.Flow.sink
; Eio.Flow.close
; unix_fd >pipe sw returns a connected pair of flows src and sink. Data written to sink can be read from src. Note that, like all FDs created by Eio, they are both marked as close-on-exec by default.
getnameinfo sockaddr returns domain name and service for sockaddr.