@@ -12,6 +12,13 @@ module Low_level : sig
1212
1313 exception Luv_error of Luv.Error. t
1414
15+ val get_loop : unit -> Luv.Loop .t
16+ (* * [get_loop ()] returns the current fiber's event loop.
17+
18+ When using the {!Luv} API directly, you {b must} pass this to any Luv function
19+ that accepts a loop as an optional argument in order to use the resource with Eio.
20+ The wrapper functions in this file all do this for you. *)
21+
1522 val or_raise : 'a or_error -> 'a
1623 (* * [or_raise (Error e)] raises [Luv_error e]. *)
1724
@@ -108,12 +115,19 @@ module Low_level : sig
108115
109116 val to_luv : 'a t -> 'a Luv.Handle .t
110117 (* * [to_luv t] returns the wrapped handle.
118+
111119 This allows unsafe access to the handle.
112120 @raise Invalid_arg if [t] is closed. *)
113121
114122 val of_luv : ?close_unix : bool -> sw :Switch .t -> 'a Luv.Handle .t -> 'a t
115123 (* * [of_luv ~sw h] wraps [h] as an open handle.
116- This is unsafe if [h] is closed directly (before or after wrapping it).
124+
125+ You {b must} pass the loop (from {!get_loop}) to any Luv function
126+ that accepts one as an optional argument
127+ in order to use the resource with the correct event loop.
128+
129+ This function is unsafe if [h] is closed directly (before or after wrapping it).
130+
117131 @param sw The handle is closed when [sw] is released, if not closed manually first.
118132 @param close_unix if [true] (the default), calling [close] also closes [fd]. *)
119133 end
0 commit comments