From 83ae0e7a4e48559c9fc66ad5c028435c9b7e7988 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Tue, 20 Feb 2024 13:51:41 -0500 Subject: [PATCH] do not expose `?ls` for `Fut.spawn` --- src/core/fut.ml | 8 ++++---- src/core/fut.mli | 6 ++---- src/core/moonpool.mli | 6 ++---- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/core/fut.ml b/src/core/fut.ml index 5cbcb366..3993b171 100644 --- a/src/core/fut.ml +++ b/src/core/fut.ml @@ -97,7 +97,7 @@ let[@inline] fulfill_idempotent self r = (* ### combinators ### *) -let spawn ?ls ~on f : _ t = +let spawn ~on f : _ t = let fut, promise = make () in let task () = @@ -110,13 +110,13 @@ let spawn ?ls ~on f : _ t = fulfill promise res in - Runner.run_async ?ls on task; + Runner.run_async on task; fut -let spawn_on_current_runner ?ls f : _ t = +let spawn_on_current_runner f : _ t = match Runner.get_current_runner () with | 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 = match peek f with diff --git a/src/core/fut.mli b/src/core/fut.mli index 7c0d4466..e3fea3fc 100644 --- a/src/core/fut.mli +++ b/src/core/fut.mli @@ -93,13 +93,11 @@ val is_failed : _ t -> bool (** {2 Combinators} *) -val spawn : - ?ls:Task_local_storage.storage -> on:Runner.t -> (unit -> 'a) -> 'a t +val spawn : on:Runner.t -> (unit -> 'a) -> 'a t (** [spaw ~on f] runs [f()] on the given runner [on], and return a future that will hold its result. *) -val spawn_on_current_runner : - ?ls:Task_local_storage.storage -> (unit -> 'a) -> 'a t +val spawn_on_current_runner : (unit -> 'a) -> 'a t (** This must be run from inside a runner, and schedules the new task on it as well. diff --git a/src/core/moonpool.mli b/src/core/moonpool.mli index 4a664c91..92ed0dd5 100644 --- a/src/core/moonpool.mli +++ b/src/core/moonpool.mli @@ -52,14 +52,12 @@ val recommended_thread_count : unit -> int this because many of them will be blocked most of the time). @since 0.5 *) -val spawn : - ?ls:Task_local_storage.storage -> on:Runner.t -> (unit -> 'a) -> 'a Fut.t +val spawn : on:Runner.t -> (unit -> 'a) -> 'a Fut.t (** [spawn ~on f] runs [f()] on the runner (a thread pool typically) and returns a future result for it. See {!Fut.spawn}. @since 0.5 *) -val spawn_on_current_runner : - ?ls:Task_local_storage.storage -> (unit -> 'a) -> 'a Fut.t +val spawn_on_current_runner : (unit -> 'a) -> 'a Fut.t (** See {!Fut.spawn_on_current_runner}. @since 0.5 *)