diff --git a/src/pool.ml b/src/pool.ml index ce10656f..7fb77ffc 100644 --- a/src/pool.ml +++ b/src/pool.ml @@ -69,6 +69,8 @@ let num_tasks_ (self : state) : int = Array.iter (fun q -> n := !n + Bb_queue.size q) self.qs; !n +[@@@ifge 5.0] + (* DLA interop *) let prepare_for_await () : Dla_.t = (* current state *) @@ -89,6 +91,12 @@ let prepare_for_await () : Dla_.t = let t = { Dla_.release; await } in t +[@@@else_] + +let prepare_for_await () = { Dla_.release = ignore; await = ignore } + +[@@@endif] + exception Got_task of task type around_task = AT_pair : (t -> 'a) * (t -> 'a -> unit) -> around_task diff --git a/src/suspend_.ml b/src/suspend_.ml index 172560fc..1a0b55df 100644 --- a/src/suspend_.ml +++ b/src/suspend_.ml @@ -33,4 +33,8 @@ let with_suspend ~(run : with_handler:bool -> task -> unit) (f : unit -> unit) : E.try_with f () { E.effc } [@@@ocaml.alert "+unstable"] +[@@@else_] + +let with_suspend ~run:_ f = f () + [@@@endif] diff --git a/src/suspend_.mli b/src/suspend_.mli index bc205616..032bc3e0 100644 --- a/src/suspend_.mli +++ b/src/suspend_.mli @@ -48,11 +48,13 @@ val suspend : suspension_handler -> unit and a task runner function. *) +[@@@endif] + val with_suspend : run:(with_handler:bool -> task -> unit) -> (unit -> unit) -> unit (** [with_suspend ~run f] runs [f()] in an environment where [suspend] will work. If [f()] suspends with suspension handler [h], this calls [h ~run k] where [k] is the suspension. -*) -[@@@endif] + This will not do anything on OCaml 4.x. +*)