mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-06 03:05:30 -05:00
do not expose ?ls for Fut.spawn
This commit is contained in:
parent
8614d4be40
commit
83ae0e7a4e
3 changed files with 8 additions and 12 deletions
|
|
@ -97,7 +97,7 @@ let[@inline] fulfill_idempotent self r =
|
||||||
|
|
||||||
(* ### combinators ### *)
|
(* ### combinators ### *)
|
||||||
|
|
||||||
let spawn ?ls ~on f : _ t =
|
let spawn ~on f : _ t =
|
||||||
let fut, promise = make () in
|
let fut, promise = make () in
|
||||||
|
|
||||||
let task () =
|
let task () =
|
||||||
|
|
@ -110,13 +110,13 @@ let spawn ?ls ~on f : _ t =
|
||||||
fulfill promise res
|
fulfill promise res
|
||||||
in
|
in
|
||||||
|
|
||||||
Runner.run_async ?ls on task;
|
Runner.run_async on task;
|
||||||
fut
|
fut
|
||||||
|
|
||||||
let spawn_on_current_runner ?ls f : _ t =
|
let spawn_on_current_runner f : _ t =
|
||||||
match Runner.get_current_runner () with
|
match Runner.get_current_runner () with
|
||||||
| None -> failwith "Fut.spawn_on_current_runner: not running on a runner"
|
| None -> failwith "Fut.spawn_on_current_runner: not running on a runner"
|
||||||
| Some on -> spawn ?ls ~on f
|
| Some on -> spawn ~on f
|
||||||
|
|
||||||
let reify_error (f : 'a t) : 'a or_error t =
|
let reify_error (f : 'a t) : 'a or_error t =
|
||||||
match peek f with
|
match peek f with
|
||||||
|
|
|
||||||
|
|
@ -93,13 +93,11 @@ val is_failed : _ t -> bool
|
||||||
|
|
||||||
(** {2 Combinators} *)
|
(** {2 Combinators} *)
|
||||||
|
|
||||||
val spawn :
|
val spawn : on:Runner.t -> (unit -> 'a) -> 'a t
|
||||||
?ls:Task_local_storage.storage -> on:Runner.t -> (unit -> 'a) -> 'a t
|
|
||||||
(** [spaw ~on f] runs [f()] on the given runner [on], and return a future that will
|
(** [spaw ~on f] runs [f()] on the given runner [on], and return a future that will
|
||||||
hold its result. *)
|
hold its result. *)
|
||||||
|
|
||||||
val spawn_on_current_runner :
|
val spawn_on_current_runner : (unit -> 'a) -> 'a t
|
||||||
?ls:Task_local_storage.storage -> (unit -> 'a) -> 'a t
|
|
||||||
(** This must be run from inside a runner, and schedules
|
(** This must be run from inside a runner, and schedules
|
||||||
the new task on it as well.
|
the new task on it as well.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,14 +52,12 @@ val recommended_thread_count : unit -> int
|
||||||
this because many of them will be blocked most of the time).
|
this because many of them will be blocked most of the time).
|
||||||
@since 0.5 *)
|
@since 0.5 *)
|
||||||
|
|
||||||
val spawn :
|
val spawn : on:Runner.t -> (unit -> 'a) -> 'a Fut.t
|
||||||
?ls:Task_local_storage.storage -> on:Runner.t -> (unit -> 'a) -> 'a Fut.t
|
|
||||||
(** [spawn ~on f] runs [f()] on the runner (a thread pool typically)
|
(** [spawn ~on f] runs [f()] on the runner (a thread pool typically)
|
||||||
and returns a future result for it. See {!Fut.spawn}.
|
and returns a future result for it. See {!Fut.spawn}.
|
||||||
@since 0.5 *)
|
@since 0.5 *)
|
||||||
|
|
||||||
val spawn_on_current_runner :
|
val spawn_on_current_runner : (unit -> 'a) -> 'a Fut.t
|
||||||
?ls:Task_local_storage.storage -> (unit -> 'a) -> 'a Fut.t
|
|
||||||
(** See {!Fut.spawn_on_current_runner}.
|
(** See {!Fut.spawn_on_current_runner}.
|
||||||
@since 0.5 *)
|
@since 0.5 *)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue