From a2ea24551bc5d8a62f8f49c55a281c3ac169b3d0 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Tue, 27 Feb 2024 22:48:23 -0500 Subject: [PATCH] compat --- src/core/suspend_.ml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/core/suspend_.ml b/src/core/suspend_.ml index 44ac324d..fefbaff3 100644 --- a/src/core/suspend_.ml +++ b/src/core/suspend_.ml @@ -10,6 +10,16 @@ type suspension_handler = { } [@@unboxed] +type with_suspend_handler = + | WSH : { + on_suspend: unit -> 'state; + (** on_suspend called when [f()] suspends itself. *) + run: 'state -> task -> unit; (** run used to schedule new tasks *) + resume: 'state -> suspension -> unit Exn_bt.result -> unit; + (** resume run the suspension. Must be called exactly once. *) + } + -> with_suspend_handler + [@@@ifge 5.0] [@@@ocaml.alert "-unstable"] @@ -22,16 +32,6 @@ type _ Effect.t += let[@inline] yield () = Effect.perform Yield let[@inline] suspend h = Effect.perform (Suspend h) -type with_suspend_handler = - | WSH : { - on_suspend: unit -> 'state; - (** on_suspend called when [f()] suspends itself. *) - run: 'state -> task -> unit; (** run used to schedule new tasks *) - resume: 'state -> suspension -> unit Exn_bt.result -> unit; - (** resume run the suspension. Must be called exactly once. *) - } - -> with_suspend_handler - let with_suspend (WSH { on_suspend; run; resume }) (f : unit -> unit) : unit = let module E = Effect.Deep in (* effect handler *)