From 8e9628ac818b02745b13c2cc3866f8fd62edd41e Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Sun, 16 Jul 2023 23:36:34 -0400 Subject: [PATCH] prepare for 0.3 --- CHANGES.md | 23 +++++++++++++++++++++++ dune-project | 2 +- moonpool.opam | 2 +- src/chan.mli | 2 +- src/fork_join.mli | 12 ++++++------ src/lock.mli | 2 +- src/pool.mli | 4 ++-- src/runner.mli | 2 +- 8 files changed, 36 insertions(+), 13 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 56bbd607..743c9e3d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,27 @@ +# 0.3 + +- add `Fork_join` for parallelizing computations. This is only + available on OCaml 5.x because it relies on effects. +- add `Fork_join.{for_,map_array,map_list}` +- add `Fork_join.all_{list,init}` +- add `Pool.with_` +- add a channel module +- add `Runner`, change `Pool` to produce a `Runner.t` +- add a `Lock` module +- add support for domain-local-await when installed +- add `Fut.await` for OCaml >= 5.0 + +- fix: Fork_join.both_ignore now has a more general type + +- expose `Suspend_` and its internal effect with an unstability alert. + This is intended for implementors of `Runner` only. +- port `cpp.ml` from containers, replace previous codegen with it. + This will provide better flexibility for supporting multiple versions + of OCaml in the future. +- add `Pool.run_wait_block`; rename `Pool.run` into `Pool.run_async` +- fix: in blocking queue, `pop` works on a non empty closed queue + # 0.2 - add `Fut.for_list` diff --git a/dune-project b/dune-project index 6b9e3c7e..e57770fb 100644 --- a/dune-project +++ b/dune-project @@ -2,7 +2,7 @@ (using mdx 0.2) (name moonpool) -(version 0.2) +(version 0.3) (generate_opam_files true) (source (github c-cube/moonpool)) diff --git a/moonpool.opam b/moonpool.opam index eca13ce4..83d18fd6 100644 --- a/moonpool.opam +++ b/moonpool.opam @@ -1,6 +1,6 @@ # This file is generated by dune, edit dune-project instead opam-version: "2.0" -version: "0.2" +version: "0.3" synopsis: "Pools of threads supported by a pool of domains" maintainer: ["Simon Cruanes"] authors: ["Simon Cruanes"] diff --git a/src/chan.mli b/src/chan.mli index dd18af2d..083cf8d5 100644 --- a/src/chan.mli +++ b/src/chan.mli @@ -47,6 +47,6 @@ val close : _ t -> unit val pop_await : 'a t -> 'a (** Like {!pop} but suspends the current thread until an element is available. See {!Fut.await} for more details. - @since NEXT_RELEASE *) + @since 0.3 *) [@@@endif] diff --git a/src/fork_join.mli b/src/fork_join.mli index a1adb83a..3ffa537d 100644 --- a/src/fork_join.mli +++ b/src/fork_join.mli @@ -61,7 +61,7 @@ val for_ : ?chunk_size:int -> int -> (int -> int -> unit) -> unit Use [~chunk_size:1] if you explicitly want to run each iteration of the loop in its own task. - @since NEXT_RELEASE + @since 0.3 {b NOTE} this is only available on OCaml 5. *) val all_array : ?chunk_size:int -> (unit -> 'a) array -> 'a array @@ -71,7 +71,7 @@ val all_array : ?chunk_size:int -> (unit -> 'a) array -> 'a array @param chunk_size if equal to [n], groups items by [n] to be run in a single task. Default is [1]. - @since NEXT_RELEASE + @since 0.3 {b NOTE} this is only available on OCaml 5. *) val all_list : ?chunk_size:int -> (unit -> 'a) list -> 'a list @@ -80,7 +80,7 @@ val all_list : ?chunk_size:int -> (unit -> 'a) list -> 'a list @param chunk_size if equal to [n], groups items by [n] to be run in a single task. Default is not specified. - This parameter is available since NEXT_RELEASE. + This parameter is available since 0.3. @since 0.3 {b NOTE} this is only available on OCaml 5. *) @@ -91,19 +91,19 @@ val all_init : ?chunk_size:int -> int -> (int -> 'a) -> 'a list @param chunk_size if equal to [n], groups items by [n] to be run in a single task. Default is not specified. - This parameter is available since NEXT_RELEASE. + This parameter is available since 0.3. @since 0.3 {b NOTE} this is only available on OCaml 5. *) val map_array : ?chunk_size:int -> ('a -> 'b) -> 'a array -> 'b array (** [map_array f arr] is like [Array.map f arr], but runs in parallel. - @since NEXT_RELEASE + @since 0.3 {b NOTE} this is only available on OCaml 5. *) 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. - @since NEXT_RELEASE + @since 0.3 {b NOTE} this is only available on OCaml 5. *) [@@@endif] diff --git a/src/lock.mli b/src/lock.mli index 4f6010f5..41ff47c6 100644 --- a/src/lock.mli +++ b/src/lock.mli @@ -1,6 +1,6 @@ (** Mutex-protected resource. - @since NEXT_RELEASE *) + @since 0.3 *) type 'a t (** A value protected by a mutex *) diff --git a/src/pool.mli b/src/pool.mli index b176c405..f99b396c 100644 --- a/src/pool.mli +++ b/src/pool.mli @@ -3,7 +3,7 @@ A pool of threads. The pool contains a fixed number of threads that wait for work items to come, process these, and loop. - This implements {!Runner.t} since NEXT_RELEASE. + This implements {!Runner.t} since 0.3. If a pool is no longer needed, {!shutdown} can be used to signal all threads in it to stop (after they finish their work), and wait for them to stop. @@ -66,7 +66,7 @@ val with_ : (unit -> (t -> 'a) -> 'a) create_args are released. Most parameters are the same as in {!create}. - @since NEXT_RELEASE *) + @since 0.3 *) val run : t -> (unit -> unit) -> unit [@@deprecated "use run_async"] diff --git a/src/runner.mli b/src/runner.mli index 9c5aca45..cda20720 100644 --- a/src/runner.mli +++ b/src/runner.mli @@ -1,7 +1,7 @@ (** Abstract runner. This provides an abstraction for running tasks in the background. - @since NEXT_RELEASE + @since 0.3 *) type task = unit -> unit