breaking: remove Immediate_runner

it never really supported all that a runner should (effects, scheduling
other tasks, etc.)
This commit is contained in:
Simon Cruanes 2024-03-04 15:48:09 -05:00
parent 25104ce3b7
commit 9df848cd17
4 changed files with 8 additions and 45 deletions

View file

@ -1,20 +0,0 @@
open Types_
include Runner
let run_async_ ~ls:cur_ls f =
TLS.get k_cur_storage := Some cur_ls;
try
let x = f () in
TLS.get k_cur_storage := None;
x
with e ->
let bt = Printexc.get_raw_backtrace () in
TLS.get k_cur_storage := None;
Printexc.raise_with_backtrace e bt
let runner : t =
Runner.For_runner_implementors.create
~size:(fun () -> 0)
~num_tasks:(fun () -> 0)
~shutdown:(fun ~wait:_ () -> ())
~run_async:run_async_ ()

View file

@ -1,23 +0,0 @@
(** Runner that runs tasks immediately in the caller thread.
Whenever a task is submitted to this runner via [Runner.run_async r task],
the task is run immediately in the caller thread as [task()].
There are no background threads, no resource, this is just a trivial
implementation of the interface.
This can be useful when an implementation needs a runner, but there isn't
enough work to justify starting an actual full thread pool.
Another situation is when threads cannot be used at all (e.g. because you
plan to call [Unix.fork] later).
{b NOTE}: this does not handle the [Suspend] effect, so [await], fork-join,
etc. will {b NOT} work on this runner.
@since 0.5
*)
include module type of Runner
val runner : t
(** The trivial runner that actually runs tasks at the calling point. *)

View file

@ -25,7 +25,7 @@ module Exn_bt = Exn_bt
module Fifo_pool = Fifo_pool
module Fut = Fut
module Lock = Lock
module Immediate_runner = Immediate_runner
module Immediate_runner = struct end
module Runner = Runner
module Task_local_storage = Task_local_storage
module Thread_local_storage = Thread_local_storage_

View file

@ -13,7 +13,13 @@ module Ws_pool = Ws_pool
module Fifo_pool = Fifo_pool
module Background_thread = Background_thread
module Runner = Runner
module Immediate_runner = Immediate_runner
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}. *)
module Exn_bt = Exn_bt
exception Shutdown