prepare for 0.3

This commit is contained in:
Simon Cruanes 2023-07-16 23:36:34 -04:00
parent 366d26527c
commit 8e9628ac81
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
8 changed files with 36 additions and 13 deletions

View file

@ -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 # 0.2
- add `Fut.for_list` - add `Fut.for_list`

View file

@ -2,7 +2,7 @@
(using mdx 0.2) (using mdx 0.2)
(name moonpool) (name moonpool)
(version 0.2) (version 0.3)
(generate_opam_files true) (generate_opam_files true)
(source (source
(github c-cube/moonpool)) (github c-cube/moonpool))

View file

@ -1,6 +1,6 @@
# This file is generated by dune, edit dune-project instead # This file is generated by dune, edit dune-project instead
opam-version: "2.0" opam-version: "2.0"
version: "0.2" version: "0.3"
synopsis: "Pools of threads supported by a pool of domains" synopsis: "Pools of threads supported by a pool of domains"
maintainer: ["Simon Cruanes"] maintainer: ["Simon Cruanes"]
authors: ["Simon Cruanes"] authors: ["Simon Cruanes"]

View file

@ -47,6 +47,6 @@ val close : _ t -> unit
val pop_await : 'a t -> 'a val pop_await : 'a t -> 'a
(** Like {!pop} but suspends the current thread until an element is (** Like {!pop} but suspends the current thread until an element is
available. See {!Fut.await} for more details. available. See {!Fut.await} for more details.
@since NEXT_RELEASE *) @since 0.3 *)
[@@@endif] [@@@endif]

View file

@ -61,7 +61,7 @@ val for_ : ?chunk_size:int -> int -> (int -> int -> unit) -> unit
Use [~chunk_size:1] if you explicitly want to Use [~chunk_size:1] if you explicitly want to
run each iteration of the loop in its own task. 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. *) {b NOTE} this is only available on OCaml 5. *)
val all_array : ?chunk_size:int -> (unit -> 'a) array -> 'a array 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 @param chunk_size if equal to [n], groups items by [n] to be run in
a single task. Default is [1]. a single task. Default is [1].
@since NEXT_RELEASE @since 0.3
{b NOTE} this is only available on OCaml 5. *) {b NOTE} this is only available on OCaml 5. *)
val all_list : ?chunk_size:int -> (unit -> 'a) list -> 'a list 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 @param chunk_size if equal to [n], groups items by [n] to be run in
a single task. Default is not specified. a single task. Default is not specified.
This parameter is available since NEXT_RELEASE. This parameter is available since 0.3.
@since 0.3 @since 0.3
{b NOTE} this is only available on OCaml 5. *) {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 @param chunk_size if equal to [n], groups items by [n] to be run in
a single task. Default is not specified. a single task. Default is not specified.
This parameter is available since NEXT_RELEASE. This parameter is available since 0.3.
@since 0.3 @since 0.3
{b NOTE} this is only available on OCaml 5. *) {b NOTE} this is only available on OCaml 5. *)
val map_array : ?chunk_size:int -> ('a -> 'b) -> 'a array -> 'b array 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. (** [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. *) {b NOTE} this is only available on OCaml 5. *)
val map_list : ?chunk_size:int -> ('a -> 'b) -> 'a list -> 'b list 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 NEXT_RELEASE @since 0.3
{b NOTE} this is only available on OCaml 5. *) {b NOTE} this is only available on OCaml 5. *)
[@@@endif] [@@@endif]

View file

@ -1,6 +1,6 @@
(** Mutex-protected resource. (** Mutex-protected resource.
@since NEXT_RELEASE *) @since 0.3 *)
type 'a t type 'a t
(** A value protected by a mutex *) (** A value protected by a mutex *)

View file

@ -3,7 +3,7 @@
A pool of threads. The pool contains a fixed number of threads that A pool of threads. The pool contains a fixed number of threads that
wait for work items to come, process these, and loop. 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 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. 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. are released.
Most parameters are the same as in {!create}. Most parameters are the same as in {!create}.
@since NEXT_RELEASE *) @since 0.3 *)
val run : t -> (unit -> unit) -> unit val run : t -> (unit -> unit) -> unit
[@@deprecated "use run_async"] [@@deprecated "use run_async"]

View file

@ -1,7 +1,7 @@
(** Abstract runner. (** Abstract runner.
This provides an abstraction for running tasks in the background. This provides an abstraction for running tasks in the background.
@since NEXT_RELEASE @since 0.3
*) *)
type task = unit -> unit type task = unit -> unit