mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-06 03:05:30 -05:00
expose Suspend_ and its internal effect with an unstability alert
This commit is contained in:
parent
e855c99bec
commit
12df71c3ab
5 changed files with 20 additions and 11 deletions
|
|
@ -9,3 +9,4 @@ module Lock = Lock
|
||||||
module Fork_join = Fork_join
|
module Fork_join = Fork_join
|
||||||
module Fut = Fut
|
module Fut = Fut
|
||||||
module Pool = Pool
|
module Pool = Pool
|
||||||
|
module Suspend_ = Suspend_
|
||||||
|
|
|
||||||
|
|
@ -77,3 +77,13 @@ module Atomic = Atomic_
|
||||||
|
|
||||||
This is either a shim using [ref], on pre-OCaml 5, or the
|
This is either a shim using [ref], on pre-OCaml 5, or the
|
||||||
standard [Atomic] module on OCaml 5. *)
|
standard [Atomic] module on OCaml 5. *)
|
||||||
|
|
||||||
|
(** {2 Suspensions} *)
|
||||||
|
|
||||||
|
module Suspend_ = Suspend_
|
||||||
|
[@@alert unstable "this module is an implementation detail of moonpool for now"]
|
||||||
|
(** Suspensions.
|
||||||
|
|
||||||
|
This is only going to work on OCaml 5.x.
|
||||||
|
|
||||||
|
{b NOTE}: this is not stable for now. *)
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,4 @@ let run_wait_block self (f : unit -> 'a) : 'a =
|
||||||
module For_runner_implementors = struct
|
module For_runner_implementors = struct
|
||||||
let create ~size ~num_tasks ~shutdown ~run_async () : t =
|
let create ~size ~num_tasks ~shutdown ~run_async () : t =
|
||||||
{ size; num_tasks; shutdown; run_async }
|
{ size; num_tasks; shutdown; run_async }
|
||||||
|
|
||||||
module Suspend_ = Suspend_
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -64,13 +64,4 @@ module For_runner_implementors : sig
|
||||||
|
|
||||||
{b NOTE}: the runner should support DLA and {!Suspend_} on OCaml 5.x,
|
{b NOTE}: the runner should support DLA and {!Suspend_} on OCaml 5.x,
|
||||||
so that {!Fork_join} and other 5.x features work properly. *)
|
so that {!Fork_join} and other 5.x features work properly. *)
|
||||||
|
|
||||||
module Suspend_ = Suspend_
|
|
||||||
[@@alert
|
|
||||||
unstable "this module is an implementation detail of moonpool for now"]
|
|
||||||
(** Suspensions.
|
|
||||||
|
|
||||||
This is only going to work on OCaml 5.x.
|
|
||||||
|
|
||||||
{b NOTE}: this is not stable for now. *)
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,15 @@ type suspension_handler = {
|
||||||
*)
|
*)
|
||||||
|
|
||||||
[@@@ifge 5.0]
|
[@@@ifge 5.0]
|
||||||
|
[@@@ocaml.alert "-unstable"]
|
||||||
|
|
||||||
|
type _ Effect.t +=
|
||||||
|
| Suspend : suspension_handler -> unit Effect.t
|
||||||
|
(** The effect used to suspend the current thread and pass it, suspended,
|
||||||
|
to the handler. The handler will ensure that the suspension is resumed later
|
||||||
|
once some computation has been done. *)
|
||||||
|
|
||||||
|
[@@@ocaml.alert "+unstable"]
|
||||||
|
|
||||||
val suspend : suspension_handler -> unit
|
val suspend : suspension_handler -> unit
|
||||||
(** [suspend h] jumps back to the nearest {!with_suspend}
|
(** [suspend h] jumps back to the nearest {!with_suspend}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue