moonpool: expose Fut.{spawn_on_current_runner,await}

This commit is contained in:
Simon Cruanes 2023-11-07 21:11:12 -05:00
parent 989c012f77
commit 3f7ed7b6b8
2 changed files with 20 additions and 0 deletions

View file

@ -5,6 +5,13 @@ let start_thread_on_some_domain f x =
let run_async = Runner.run_async
let recommended_thread_count () = Domain_.recommended_number ()
let spawn = Fut.spawn
let spawn_on_current_runner = Fut.spawn_on_current_runner
[@@@ifge 5.0]
let await = Fut.await
[@@@endif]
module Atomic = Atomic_
module Blocking_queue = Bb_queue

View file

@ -40,6 +40,19 @@ val spawn : on:Runner.t -> (unit -> 'a) -> 'a Fut.t
and returns a future result for it. See {!Fut.spawn}.
@since NEXT_RELEASE *)
val spawn_on_current_runner : (unit -> 'a) -> 'a Fut.t
(** See {!Fut.spawn_on_current_runner}.
@since NEXT_RELEASE *)
[@@@ifge 5.0]
val await : 'a Fut.t -> 'a
(** Await a future. See {!Fut.await}.
Only on OCaml >= 5.0.
@since NEXT_RELEASE *)
[@@@endif]
module Lock = Lock
module Fut = Fut
module Chan = Chan