prepare for 0.6

This commit is contained in:
Simon Cruanes 2024-03-20 15:20:28 -04:00
parent a127a4131a
commit 0750e6af41
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
16 changed files with 49 additions and 22 deletions

View file

@ -1,4 +1,29 @@
# 0.6
- breaking: remove `Immediate_runner` (bug prone and didn't
handle effects). `Moonpool_fib.main` can be used to handle
effects in the main function.
- remove deprecated alias `Moonpool.Pool`
- feat: add structured concurrency sub-library `moonpool.fib` with
fibers. Fibers can use `await` and spawn other fibers that will
be appropriately cancelled when their parent is.
- feat: add add `moonpool-lwt` as an experimental bridge between moonpool and lwt.
This allows moonpool runners to be used from within Lwt to
perform background computations, and conversely to call Lwt from
moonpool with some precautions.
- feat: task-local storage in the main moonpool runners, available from
fibers and regular tasks.
- feat: add `Exn_bt` to core
- feat: add `Runner.dummy`
- make `moonpool.forkjoin` optional (only on OCaml >= 5.0)
- feat: add `Fut.Advanced.barrier_on_abstract_container_of_futures`
- feat: add `Fut.map_list`
- refactor: split off domain pool to `moonpool.dpool`
- fix too early exit in Ws_pool
# 0.5.1
- fix `Ws_pool`: workers would exit before processing

View file

@ -2,7 +2,7 @@
(using mdx 0.2)
(name moonpool)
(version 0.5.1)
(version 0.6)
(generate_opam_files true)
(source
(github c-cube/moonpool))
@ -35,7 +35,7 @@
(package
(name moonpool-lwt)
(synopsis "Event loop for moonpool based on Lwt-engine")
(synopsis "Event loop for moonpool based on Lwt-engine (experimental)")
(allow_empty) ; on < 5.0
(depends
(moonpool (= :version))

View file

@ -1,7 +1,7 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "0.5.1"
synopsis: "Event loop for moonpool based on Lwt-engine"
version: "0.6"
synopsis: "Event loop for moonpool based on Lwt-engine (experimental)"
maintainer: ["Simon Cruanes"]
authors: ["Simon Cruanes"]
license: "MIT"

View file

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

View file

@ -6,7 +6,7 @@
This is similar to {!Fifo_pool} with exactly one thread.
@since NEXT_RELEASE
@since 0.6
*)
include module type of Runner

View file

@ -1,6 +1,6 @@
(** Exception with backtrace.
@since NEXT_RELEASE *)
@since 0.6 *)
type t = exn * Printexc.raw_backtrace
(** An exception bundled with a backtrace *)

View file

@ -36,7 +36,7 @@ val create : (unit -> t, _) create_args
@param on_exit_thread called at the end of each worker thread in the pool.
@param around_task a pair of [before, after] functions
ran around each task. See {!Pool.create_args}.
@param name name for the pool, used in tracing (since NEXT_RELEASE)
@param name name for the pool, used in tracing (since 0.6)
*)
val with_ : (unit -> (t -> 'a) -> 'a, _) create_args

View file

@ -52,7 +52,7 @@ val fail : exn -> Printexc.raw_backtrace -> _ t
val fail_exn_bt : Exn_bt.t -> _ t
(** Fail from a bundle of exception and backtrace
@since NEXT_RELEASE *)
@since 0.6 *)
val of_result : 'a or_error -> 'a t
@ -85,15 +85,15 @@ val is_done : _ t -> bool
val is_success : _ t -> bool
(** Checks if the future is resolved with [Ok _] as a result.
@since NEXT_RELEASE *)
@since 0.6 *)
val is_failed : _ t -> bool
(** Checks if the future is resolved with [Error _] as a result.
@since NEXT_RELEASE *)
@since 0.6 *)
val raise_if_failed : _ t -> unit
(** [raise_if_failed fut] raises [e] if [fut] failed with [e].
@since NEXT_RELEASE *)
@since 0.6 *)
(** {2 Combinators} *)

View file

@ -18,14 +18,14 @@ module Immediate_runner : sig end
[@@deprecated "use Moonpool_fib.Main"]
(** Runner that runs tasks in the caller thread.
This is removed since NEXT_RELEASE, and replaced by {!Moonpool_fib.Main}. *)
This is removed since 0.6, and replaced by {!Moonpool_fib.Main}. *)
module Exn_bt = Exn_bt
exception Shutdown
(** Exception raised when trying to run tasks on
runners that have been shut down.
@since NEXT_RELEASE *)
@since 0.6 *)
val start_thread_on_some_domain : ('a -> unit) -> 'a -> Thread.t
(** Similar to {!Thread.create}, but it picks a background domain at random
@ -48,7 +48,7 @@ val run_wait_block : ?ls:Task_local_storage.t -> Runner.t -> (unit -> 'a) -> 'a
{b NOTE} be careful with deadlocks (see notes in {!Fut.wait_block}
about the required discipline to avoid deadlocks).
@raise Shutdown if the runner was already shut down
@since NEXT_RELEASE *)
@since 0.6 *)
val recommended_thread_count : unit -> int
(** Number of threads recommended to saturate the CPU.

View file

@ -54,7 +54,7 @@ val run_wait_block : ?ls:Task_local_storage.t -> t -> (unit -> 'a) -> 'a
val dummy : t
(** Runner that fails when scheduling tasks on it.
Calling {!run_async} on it will raise Failure.
@since NEXT_RELEASE *)
@since 0.6 *)
(** {2 Implementing runners} *)

View file

@ -5,7 +5,7 @@
the current thread. The storage is carried along in case
the current task is suspended.
@since NEXT_RELEASE
@since 0.6
*)
type t = Types_.local_storage

View file

@ -45,7 +45,7 @@ val create : (unit -> t, _) create_args
before a task is processed,
on the worker thread about to run it, and returns [x]; and [after pool x] is called by
the same thread after the task is over. (since 0.2)
@param name a name for this thread pool, used if tracing is enabled (since NEXT_RELEASE)
@param name a name for this thread pool, used if tracing is enabled (since 0.6)
*)
val with_ : (unit -> (t -> 'a) -> 'a, _) create_args

View file

@ -11,7 +11,7 @@
{b NOTE}: Interface is still experimental.
@since NEXT_RELEASE
@since 0.6
*)
type domain = Domain_.t

View file

@ -16,7 +16,7 @@
This handles effects, including the ones in {!Fiber}.
@since NEXT_RELEASE
@since 0.6
*)
val main : (Moonpool.Runner.t -> 'a) -> 'a

View file

@ -2,7 +2,7 @@
See {!Fiber} for the most important explanations.
@since NEXT_RELEASE. *)
@since 0.6. *)
module Fiber = Fiber
module Fls = Fls

View file

@ -4,7 +4,9 @@
running [Lwt_main.run] (so, the thread where the Lwt event
loop and all Lwt callbacks execute).
@since NEXT_RELEASE *)
{b NOTE}: this is experimental and might change in future versions.
@since 0.6 *)
module Fiber = Moonpool_fib.Fiber
module FLS = Moonpool_fib.Fls