From dd60666676e3aebd7618e2ec11ebf0234a360ca0 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Mon, 26 Aug 2024 13:12:58 -0400 Subject: [PATCH] refactor: remove dla --- src/core/fifo_pool.ml | 20 ++++++-------------- src/core/suspend_.ml | 17 ----------------- src/core/suspend_.mli | 3 --- src/core/ws_pool.ml | 2 +- src/private/dla_.dummy.ml | 13 ------------- src/private/dla_.real.ml | 9 --------- src/private/dune | 5 ----- 7 files changed, 7 insertions(+), 62 deletions(-) delete mode 100644 src/private/dla_.dummy.ml delete mode 100644 src/private/dla_.real.ml diff --git a/src/core/fifo_pool.ml b/src/core/fifo_pool.ml index a16d5b08..7c1b491b 100644 --- a/src/core/fifo_pool.ml +++ b/src/core/fifo_pool.ml @@ -76,20 +76,12 @@ let worker_thread_ (self : state) (runner : t) ~on_exn ~around_task : unit = TLS.set k_cur_storage _dummy_ls in - let main_loop () = - let continue = ref true in - while !continue do - match Bb_queue.pop self.q with - | task -> run_task task - | exception Bb_queue.Closed -> continue := false - done - in - - try - (* handle domain-local await *) - Dla_.using ~prepare_for_await:Suspend_.prepare_for_await - ~while_running:main_loop - with Bb_queue.Closed -> () + let continue = ref true in + while !continue do + match Bb_queue.pop self.q with + | task -> run_task task + | exception Bb_queue.Closed -> continue := false + done let default_thread_init_exit_ ~dom_id:_ ~t_id:_ () = () diff --git a/src/core/suspend_.ml b/src/core/suspend_.ml index 8d7d229f..0d62e6fb 100644 --- a/src/core/suspend_.ml +++ b/src/core/suspend_.ml @@ -62,26 +62,9 @@ let with_suspend (WSH { on_suspend; run; resume }) (f : unit -> unit) : unit = E.try_with f () { E.effc } -(* DLA interop *) -let prepare_for_await () : Dla_.t = - (* current state *) - let st : (_ * suspension) option A.t = A.make None in - - let release () : unit = - match A.exchange st None with - | None -> () - | Some (resume, k) -> resume k @@ Ok () - and await () : unit = - suspend { handle = (fun ~run:_ ~resume k -> A.set st (Some (resume, k))) } - in - - let t = { Dla_.release; await } in - t - [@@@ocaml.alert "+unstable"] [@@@else_] let[@inline] with_suspend (WSH _) f = f () -let[@inline] prepare_for_await () = { Dla_.release = ignore; await = ignore } [@@@endif] diff --git a/src/core/suspend_.mli b/src/core/suspend_.mli index de90e2d4..7a71b36d 100644 --- a/src/core/suspend_.mli +++ b/src/core/suspend_.mli @@ -84,6 +84,3 @@ val with_suspend : with_suspend_handler -> (unit -> unit) -> unit The suspension should always be passed exactly once to [resume]. [run] should be used to start other tasks. *) - -val prepare_for_await : unit -> Dla_.t -(** Our stub for DLA. Unstable. *) diff --git a/src/core/ws_pool.ml b/src/core/ws_pool.ml index de4b44cc..8b451ade 100644 --- a/src/core/ws_pool.ml +++ b/src/core/ws_pool.ml @@ -265,7 +265,7 @@ let worker_thread_ (self : state) ~(runner : t) (w : worker_state) : unit = in (* handle domain-local await *) - Dla_.using ~prepare_for_await:Suspend_.prepare_for_await ~while_running:main + main () let default_thread_init_exit_ ~dom_id:_ ~t_id:_ () = () diff --git a/src/private/dla_.dummy.ml b/src/private/dla_.dummy.ml deleted file mode 100644 index 3991ff1a..00000000 --- a/src/private/dla_.dummy.ml +++ /dev/null @@ -1,13 +0,0 @@ -(** Interface to Domain-local-await. - - This is used to handle the presence or absence of DLA. *) - -type t = { - release: unit -> unit; - await: unit -> unit; -} - -let using : prepare_for_await:(unit -> t) -> while_running:(unit -> 'a) -> 'a = - fun ~prepare_for_await:_ ~while_running -> while_running () - -let setup_domain () = () diff --git a/src/private/dla_.real.ml b/src/private/dla_.real.ml deleted file mode 100644 index 5f99d714..00000000 --- a/src/private/dla_.real.ml +++ /dev/null @@ -1,9 +0,0 @@ -type t = Domain_local_await.t = { - release: unit -> unit; - await: unit -> unit; -} - -let using : prepare_for_await:(unit -> t) -> while_running:(unit -> 'a) -> 'a = - Domain_local_await.using - -let setup_domain () = Domain_local_await.per_thread (module Thread) diff --git a/src/private/dune b/src/private/dune index 37b5a925..cd480080 100644 --- a/src/private/dune +++ b/src/private/dune @@ -13,11 +13,6 @@ from (thread-local-storage -> thread_local_storage_.stub.ml) (-> thread_local_storage_.real.ml)) - (select - dla_.ml - from - (domain-local-await -> dla_.real.ml) - (-> dla_.dummy.ml)) (select tracing_.ml from