Skip to content

Commit

Permalink
Add some notes about thread-safety in the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
talex5 committed Jun 26, 2023
1 parent 3e49036 commit 767f90d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib_eio/flow.mli
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,13 @@ end
val write : #sink -> Cstruct.t list -> unit
(** [write dst bufs] writes all bytes from [bufs].
This is a low level API, consider using {!copy} if possible as it
may allow optimizations. *)
You should not perform multiple concurrent writes on the same flow
(the output may get interleaved).
This is a low level API. Consider using:
- {!Buf_write} to combine multiple small writes.
- {!copy} for bulk transfers, as it allows some extra optimizations. *)

val copy : #source -> #sink -> unit
(** [copy src dst] copies data from [src] to [dst] until end-of-file. *)
Expand Down
1 change: 1 addition & 0 deletions lib_main/eio_main.mli
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ val run : (Eio_unix.Stdenv.base -> 'a) -> 'a
(** [run fn] runs an event loop and then calls [fn env] within it.
[env] provides access to the process's environment (file-system, network, etc).
[env] itself and the resources inside it can be shared safely between Eio domains.
When [fn] ends, the event loop finishes.
Expand Down

0 comments on commit 767f90d

Please sign in to comment.