This commit is contained in:
Simon Cruanes 2025-09-08 08:08:18 -04:00
parent 8a8299020a
commit 76efa381c3
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4

View file

@ -1,17 +1,17 @@
type 'a t = { type 'a t = {
mutable size: int; mutable size: int;
mutable q: 'a list; mutable q: 'a list;
(* The queue is a FIFO represented as a list in reverse order *) (** The queue is a FIFO represented as a list in reverse order *)
batch: int; (* Minimum size to batch before popping *) batch: int; (** Minimum size to batch before popping *)
high_watermark: int; high_watermark: int; (** Size above which we start dropping signals *)
timeout: Mtime.span option; timeout: Mtime.span option;
mutable start: Mtime.t; mutable start: Mtime.t;
mutex: Mutex.t; mutex: Mutex.t;
} }
(* Mutex.protect was added in OCaml 5.1, but we want support back to 4.08 *) (* Mutex.protect was added in OCaml 5.1, but we want support back to 4.08.
(* cannot inline, otherwise flambda might move code around. (as per Stdlib) *) cannot inline, otherwise flambda might move code around. (as per Stdlib) *)
let[@inline never] protect m f = let[@inline never] protect_mutex m f =
Mutex.lock m; Mutex.lock m;
Fun.protect f ~finally:(fun () -> Mutex.unlock m) Fun.protect f ~finally:(fun () -> Mutex.unlock m)