···66let n_iters = 1_000_000 (* How many times to accept and resubmit *)
7788let rec wait t handle =
99- match Uring.peek t with
99+ match Uring.get_cqe_nonblocking t with
1010 | Some { result; data = buf } -> handle result buf
1111 | None ->
1212 match Uring.wait t with
+3-1
lib/uring/uring.ml
···474474 let data = Heap.free t.data user_data_id in
475475 Some { result = res; data }
476476477477-let peek t =
477477+let get_cqe_nonblocking t =
478478 gc_sketch t;
479479 fn_on_ring Uring.peek_cqe t
480480+481481+let peek = get_cqe_nonblocking
480482481483let wait ?timeout t =
482484 let r =
+7-3
lib/uring/uring.mli
···282282283283val wait : ?timeout:float -> 'a t -> 'a completion_option
284284(** [wait ?timeout t] will block indefinitely (the default) or for [timeout]
285285- seconds for any outstanding events to complete on uring [t]. Events should
286286- have been queued via {!submit} previously to this call. *)
285285+ seconds for any outstanding events to complete on uring [t].
286286+ This calls {!submit} automatically. *)
287287+288288+val get_cqe_nonblocking : 'a t -> 'a completion_option
289289+(** [get_cqe_nonblocking t] returns the next completion entry from the uring [t].
290290+ It is like {!wait} except that it returns [None] instead of blocking. *)
287291288292val peek : 'a t -> 'a completion_option
289289-(** [peek t] looks for completed requests on the uring [t] without blocking. *)
293293+[@@deprecated "Renamed to Uring.get_cqe_nonblocking"]
290294291295val error_of_errno : int -> Unix.error
292296(** [error_of_errno e] converts the error code [abs e] to a Unix error type. *)
+1-1
tests/urcp_fixed_lib.ml
···135135 let got_completion = ref false in
136136 let rec handle_completions () =
137137 if t.write_left > 0 then begin
138138- let check_q = if !got_completion then Uring.peek uring else Uring.wait uring in
138138+ let check_q = if !got_completion then Uring.get_cqe_nonblocking uring else Uring.wait uring in
139139 match check_q with
140140 |None -> Logs.debug (fun l -> l "completions: retry so finishing loop")
141141 |Some { data; result } ->
+1-1
tests/urcp_lib.ml
···140140 let got_completion = ref false in
141141 let rec handle_completions () =
142142 if t.write_left > 0 then begin
143143- let check_q = if !got_completion then Uring.peek uring else Uring.wait uring in
143143+ let check_q = if !got_completion then Uring.get_cqe_nonblocking uring else Uring.wait uring in
144144 match check_q with
145145 |None -> Logs.debug (fun l -> l "completions: retry so finishing loop")
146146 |Some { data; result } ->