Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some notes about thread-safety in the documentation #568

Merged
merged 1 commit into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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