mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-05 19:00:33 -05:00
feat: add Runner.dummy
This commit is contained in:
parent
66f95df3b4
commit
51459f9b0b
3 changed files with 14 additions and 1 deletions
|
|
@ -43,5 +43,14 @@ module For_runner_implementors = struct
|
|||
let k_cur_runner : t option ref TLS.key = Types_.k_cur_runner
|
||||
end
|
||||
|
||||
let dummy : t =
|
||||
For_runner_implementors.create
|
||||
~size:(fun () -> 0)
|
||||
~num_tasks:(fun () -> 0)
|
||||
~shutdown:(fun ~wait:_ () -> ())
|
||||
~run_async:(fun ~ls:_ _ ->
|
||||
failwith "Runner.dummy: cannot actually run tasks")
|
||||
()
|
||||
|
||||
let get_current_runner = get_current_runner
|
||||
let get_current_storage = get_current_storage
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@ val run_wait_block : ?ls:Task_local_storage.t -> t -> (unit -> 'a) -> 'a
|
|||
about the required discipline to avoid deadlocks).
|
||||
@raise Shutdown if the runner was already shut down *)
|
||||
|
||||
val dummy : t
|
||||
(** Runner that fails when scheduling tasks on it.
|
||||
Calling {!run_async} on it will raise Failure. *)
|
||||
|
||||
(** {2 Implementing runners} *)
|
||||
|
||||
(** This module is specifically intended for users who implement their
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ let create_done_ ~res () : _ t =
|
|||
@@ Alive { children = FM.empty; on_cancel = Int_map.empty; cancel_id = 0 };
|
||||
id;
|
||||
res;
|
||||
runner = Immediate_runner.runner;
|
||||
runner = Runner.dummy;
|
||||
ls = Task_local_storage.dummy;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue