mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-06 03:05:30 -05:00
prepare for 0.6
This commit is contained in:
parent
a127a4131a
commit
0750e6af41
16 changed files with 49 additions and 22 deletions
25
CHANGES.md
25
CHANGES.md
|
|
@ -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
|
# 0.5.1
|
||||||
|
|
||||||
- fix `Ws_pool`: workers would exit before processing
|
- fix `Ws_pool`: workers would exit before processing
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
(using mdx 0.2)
|
(using mdx 0.2)
|
||||||
|
|
||||||
(name moonpool)
|
(name moonpool)
|
||||||
(version 0.5.1)
|
(version 0.6)
|
||||||
(generate_opam_files true)
|
(generate_opam_files true)
|
||||||
(source
|
(source
|
||||||
(github c-cube/moonpool))
|
(github c-cube/moonpool))
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
(package
|
(package
|
||||||
(name moonpool-lwt)
|
(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
|
(allow_empty) ; on < 5.0
|
||||||
(depends
|
(depends
|
||||||
(moonpool (= :version))
|
(moonpool (= :version))
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# 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.5.1"
|
version: "0.6"
|
||||||
synopsis: "Event loop for moonpool based on Lwt-engine"
|
synopsis: "Event loop for moonpool based on Lwt-engine (experimental)"
|
||||||
maintainer: ["Simon Cruanes"]
|
maintainer: ["Simon Cruanes"]
|
||||||
authors: ["Simon Cruanes"]
|
authors: ["Simon Cruanes"]
|
||||||
license: "MIT"
|
license: "MIT"
|
||||||
|
|
|
||||||
|
|
@ -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.5.1"
|
version: "0.6"
|
||||||
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"]
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
This is similar to {!Fifo_pool} with exactly one thread.
|
This is similar to {!Fifo_pool} with exactly one thread.
|
||||||
|
|
||||||
@since NEXT_RELEASE
|
@since 0.6
|
||||||
*)
|
*)
|
||||||
|
|
||||||
include module type of Runner
|
include module type of Runner
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
(** Exception with backtrace.
|
(** Exception with backtrace.
|
||||||
|
|
||||||
@since NEXT_RELEASE *)
|
@since 0.6 *)
|
||||||
|
|
||||||
type t = exn * Printexc.raw_backtrace
|
type t = exn * Printexc.raw_backtrace
|
||||||
(** An exception bundled with a backtrace *)
|
(** An exception bundled with a backtrace *)
|
||||||
|
|
|
||||||
|
|
@ -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 on_exit_thread called at the end of each worker thread in the pool.
|
||||||
@param around_task a pair of [before, after] functions
|
@param around_task a pair of [before, after] functions
|
||||||
ran around each task. See {!Pool.create_args}.
|
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
|
val with_ : (unit -> (t -> 'a) -> 'a, _) create_args
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ val fail : exn -> Printexc.raw_backtrace -> _ t
|
||||||
|
|
||||||
val fail_exn_bt : Exn_bt.t -> _ t
|
val fail_exn_bt : Exn_bt.t -> _ t
|
||||||
(** Fail from a bundle of exception and backtrace
|
(** Fail from a bundle of exception and backtrace
|
||||||
@since NEXT_RELEASE *)
|
@since 0.6 *)
|
||||||
|
|
||||||
val of_result : 'a or_error -> 'a t
|
val of_result : 'a or_error -> 'a t
|
||||||
|
|
||||||
|
|
@ -85,15 +85,15 @@ val is_done : _ t -> bool
|
||||||
|
|
||||||
val is_success : _ t -> bool
|
val is_success : _ t -> bool
|
||||||
(** Checks if the future is resolved with [Ok _] as a result.
|
(** Checks if the future is resolved with [Ok _] as a result.
|
||||||
@since NEXT_RELEASE *)
|
@since 0.6 *)
|
||||||
|
|
||||||
val is_failed : _ t -> bool
|
val is_failed : _ t -> bool
|
||||||
(** Checks if the future is resolved with [Error _] as a result.
|
(** Checks if the future is resolved with [Error _] as a result.
|
||||||
@since NEXT_RELEASE *)
|
@since 0.6 *)
|
||||||
|
|
||||||
val raise_if_failed : _ t -> unit
|
val raise_if_failed : _ t -> unit
|
||||||
(** [raise_if_failed fut] raises [e] if [fut] failed with [e].
|
(** [raise_if_failed fut] raises [e] if [fut] failed with [e].
|
||||||
@since NEXT_RELEASE *)
|
@since 0.6 *)
|
||||||
|
|
||||||
(** {2 Combinators} *)
|
(** {2 Combinators} *)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,14 +18,14 @@ module Immediate_runner : sig end
|
||||||
[@@deprecated "use Moonpool_fib.Main"]
|
[@@deprecated "use Moonpool_fib.Main"]
|
||||||
(** Runner that runs tasks in the caller thread.
|
(** 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
|
module Exn_bt = Exn_bt
|
||||||
|
|
||||||
exception Shutdown
|
exception Shutdown
|
||||||
(** Exception raised when trying to run tasks on
|
(** Exception raised when trying to run tasks on
|
||||||
runners that have been shut down.
|
runners that have been shut down.
|
||||||
@since NEXT_RELEASE *)
|
@since 0.6 *)
|
||||||
|
|
||||||
val start_thread_on_some_domain : ('a -> unit) -> 'a -> Thread.t
|
val start_thread_on_some_domain : ('a -> unit) -> 'a -> Thread.t
|
||||||
(** Similar to {!Thread.create}, but it picks a background domain at random
|
(** 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}
|
{b NOTE} be careful with deadlocks (see notes in {!Fut.wait_block}
|
||||||
about the required discipline to avoid deadlocks).
|
about the required discipline to avoid deadlocks).
|
||||||
@raise Shutdown if the runner was already shut down
|
@raise Shutdown if the runner was already shut down
|
||||||
@since NEXT_RELEASE *)
|
@since 0.6 *)
|
||||||
|
|
||||||
val recommended_thread_count : unit -> int
|
val recommended_thread_count : unit -> int
|
||||||
(** Number of threads recommended to saturate the CPU.
|
(** Number of threads recommended to saturate the CPU.
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ val run_wait_block : ?ls:Task_local_storage.t -> t -> (unit -> 'a) -> 'a
|
||||||
val dummy : t
|
val dummy : t
|
||||||
(** Runner that fails when scheduling tasks on it.
|
(** Runner that fails when scheduling tasks on it.
|
||||||
Calling {!run_async} on it will raise Failure.
|
Calling {!run_async} on it will raise Failure.
|
||||||
@since NEXT_RELEASE *)
|
@since 0.6 *)
|
||||||
|
|
||||||
(** {2 Implementing runners} *)
|
(** {2 Implementing runners} *)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
the current thread. The storage is carried along in case
|
the current thread. The storage is carried along in case
|
||||||
the current task is suspended.
|
the current task is suspended.
|
||||||
|
|
||||||
@since NEXT_RELEASE
|
@since 0.6
|
||||||
*)
|
*)
|
||||||
|
|
||||||
type t = Types_.local_storage
|
type t = Types_.local_storage
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ val create : (unit -> t, _) create_args
|
||||||
before a task is processed,
|
before a task is processed,
|
||||||
on the worker thread about to run it, and returns [x]; and [after pool x] is called by
|
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)
|
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
|
val with_ : (unit -> (t -> 'a) -> 'a, _) create_args
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
{b NOTE}: Interface is still experimental.
|
{b NOTE}: Interface is still experimental.
|
||||||
|
|
||||||
@since NEXT_RELEASE
|
@since 0.6
|
||||||
*)
|
*)
|
||||||
|
|
||||||
type domain = Domain_.t
|
type domain = Domain_.t
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
This handles effects, including the ones in {!Fiber}.
|
This handles effects, including the ones in {!Fiber}.
|
||||||
|
|
||||||
@since NEXT_RELEASE
|
@since 0.6
|
||||||
*)
|
*)
|
||||||
|
|
||||||
val main : (Moonpool.Runner.t -> 'a) -> 'a
|
val main : (Moonpool.Runner.t -> 'a) -> 'a
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
See {!Fiber} for the most important explanations.
|
See {!Fiber} for the most important explanations.
|
||||||
|
|
||||||
@since NEXT_RELEASE. *)
|
@since 0.6. *)
|
||||||
|
|
||||||
module Fiber = Fiber
|
module Fiber = Fiber
|
||||||
module Fls = Fls
|
module Fls = Fls
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,9 @@
|
||||||
running [Lwt_main.run] (so, the thread where the Lwt event
|
running [Lwt_main.run] (so, the thread where the Lwt event
|
||||||
loop and all Lwt callbacks execute).
|
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 Fiber = Moonpool_fib.Fiber
|
||||||
module FLS = Moonpool_fib.Fls
|
module FLS = Moonpool_fib.Fls
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue