make moonpool.forkjoin optional (only on OCaml >= 5.0)

This commit is contained in:
Simon Cruanes 2024-02-02 20:50:17 -05:00
parent 49c6cd3f53
commit b8ce0c9fe3
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
3 changed files with 3 additions and 11 deletions

View file

@ -5,8 +5,8 @@
(public_name moonpool.forkjoin) (public_name moonpool.forkjoin)
(synopsis "Fork-join parallelism for moonpool") (synopsis "Fork-join parallelism for moonpool")
(flags :standard -open Moonpool) (flags :standard -open Moonpool)
(preprocess (optional)
(action (enabled_if
(run %{project_root}/src/cpp/cpp.exe %{input-file}))) (>= %{ocaml_version} 5.0))
(libraries (libraries
moonpool moonpool.private)) moonpool moonpool.private))

View file

@ -1,5 +1,3 @@
[@@@ifge 5.0]
module A = Moonpool.Atomic module A = Moonpool.Atomic
module Suspend_ = Moonpool.Private.Suspend_ module Suspend_ = Moonpool.Private.Suspend_
module Domain_ = Moonpool_private.Domain_ module Domain_ = Moonpool_private.Domain_
@ -218,5 +216,3 @@ let map_list ?chunk_size f (l : _ list) : _ list =
match res.(i) with match res.(i) with
| None -> assert false | None -> assert false
| Some x -> x) | Some x -> x)
[@@@endif]

View file

@ -4,8 +4,6 @@
@since 0.3 *) @since 0.3 *)
[@@@ifge 5.0]
val both : (unit -> 'a) -> (unit -> 'b) -> 'a * 'b val both : (unit -> 'a) -> (unit -> 'b) -> 'a * 'b
(** [both f g] runs [f()] and [g()], potentially in parallel, (** [both f g] runs [f()] and [g()], potentially in parallel,
and returns their result when both are done. and returns their result when both are done.
@ -105,5 +103,3 @@ val map_list : ?chunk_size:int -> ('a -> 'b) -> 'a list -> 'b list
(** [map_list f l] is like [List.map f l], but runs in parallel. (** [map_list f l] is like [List.map f l], but runs in parallel.
@since 0.3 @since 0.3
{b NOTE} this is only available on OCaml 5. *) {b NOTE} this is only available on OCaml 5. *)
[@@@endif]