Skip to content

Commit

Permalink
prepare for 0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
c-cube committed Apr 2, 2024
1 parent a127a41 commit 0750e6a
Show file tree
Hide file tree
Showing 16 changed files with 49 additions and 22 deletions.
25 changes: 25 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions moonpool-lwt.opam
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion moonpool.opam
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion src/core/background_thread.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/core/exn_bt.mli
Original file line number Diff line number Diff line change
@@ -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 *)
Expand Down
2 changes: 1 addition & 1 deletion src/core/fifo_pool.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/core/fut.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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} *)

Expand Down
6 changes: 3 additions & 3 deletions src/core/moonpool.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/core/runner.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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} *)

Expand Down
2 changes: 1 addition & 1 deletion src/core/task_local_storage.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/core/ws_pool.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/dpool/moonpool_dpool.mli
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{b NOTE}: Interface is still experimental.
@since NEXT_RELEASE
@since 0.6
*)

type domain = Domain_.t
Expand Down
2 changes: 1 addition & 1 deletion src/fib/main.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/fib/moonpool_fib.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
See {!Fiber} for the most important explanations.
@since NEXT_RELEASE. *)
@since 0.6. *)

module Fiber = Fiber
module Fls = Fls
Expand Down
4 changes: 3 additions & 1 deletion src/lwt/moonpool_lwt.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0750e6a

Please sign in to comment.