Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor code cleanups #755

Merged
merged 2 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib_eio/core/dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(library
(name eio__core)
(public_name eio.core)
(libraries cstruct hmap lwt-dllist fmt optint domain-local-await eio.runtime_events))
(libraries hmap lwt-dllist fmt optint eio.runtime_events))
2 changes: 0 additions & 2 deletions lib_eio/core/eio__core.ml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,4 @@ module Private = struct
| Fork = Fiber.Fork
| Get_context = Cancel.Get_context
end

module Dla = Dla
end
4 changes: 0 additions & 4 deletions lib_eio/core/eio__core.mli
Original file line number Diff line number Diff line change
Expand Up @@ -782,8 +782,4 @@ module Private : sig
val v : t
(** Backends should use this for {!Eio.Stdenv.debug}. *)
end

module Dla : sig
val prepare_for_await : unit -> Domain_local_await.t
end
end
2 changes: 1 addition & 1 deletion lib_eio/mock/backend.ml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ let run_full main =
let result = ref None in
let `Exit_scheduler =
Domain_local_await.using
~prepare_for_await:Eio.Private.Dla.prepare_for_await
~prepare_for_await:Eio_utils.Dla.prepare_for_await
~while_running:(fun () ->
fork ~new_fiber (fun () -> result := Some (main stdenv))) in
match !result with
Expand Down
4 changes: 2 additions & 2 deletions lib_eio/core/dla.ml → lib_eio/utils/dla.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ let prepare_for_await () =
| _ -> ()
and await () =
if Atomic.get state != `Released then
Suspend.enter "domain-local-await" @@ fun ctx enqueue ->
Eio.Private.Suspend.enter "domain-local-await" @@ fun ctx enqueue ->
let awaiting = `Awaiting enqueue in
if Atomic.compare_and_set state `Init awaiting then (
Cancel.Fiber_context.set_cancel_fn ctx (fun ex ->
Eio.Private.Fiber_context.set_cancel_fn ctx (fun ex ->
if Atomic.compare_and_set state awaiting `Released then (
enqueue (Error ex)
)
Expand Down
1 change: 1 addition & 0 deletions lib_eio/utils/dla.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
val prepare_for_await : unit -> Domain_local_await.t
2 changes: 1 addition & 1 deletion lib_eio/utils/dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(library
(name eio_utils)
(public_name eio.utils)
(libraries eio psq fmt optint))
(libraries eio psq fmt optint domain-local-await))
1 change: 1 addition & 0 deletions lib_eio/utils/eio_utils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
module Lf_queue = Lf_queue
module Suspended = Suspended
module Zzz = Zzz
module Dla = Dla
2 changes: 1 addition & 1 deletion lib_eio_linux/sched.ml
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ let run ~extra_effects st main arg =
let `Exit_scheduler =
let new_fiber = Fiber_context.make_root () in
Domain_local_await.using
~prepare_for_await:Eio.Private.Dla.prepare_for_await
~prepare_for_await:Eio_utils.Dla.prepare_for_await
~while_running:(fun () ->
fork ~new_fiber (fun () ->
Switch.run_protected ~name:"eio_linux" (fun sw ->
Expand Down
2 changes: 1 addition & 1 deletion lib_eio_posix/sched.ml
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ let run ~extra_effects t main x =
let `Exit_scheduler =
let new_fiber = Fiber_context.make_root () in
Domain_local_await.using
~prepare_for_await:Eio.Private.Dla.prepare_for_await
~prepare_for_await:Eio_utils.Dla.prepare_for_await
~while_running:(fun () ->
fork ~new_fiber (fun () ->
Eio_unix.Private.Thread_pool.run t.thread_pool @@ fun () ->
Expand Down
2 changes: 1 addition & 1 deletion lib_eio_windows/sched.ml
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ let run ~extra_effects t main x =
let `Exit_scheduler =
let new_fiber = Fiber_context.make_root () in
Domain_local_await.using
~prepare_for_await:Eio.Private.Dla.prepare_for_await
~prepare_for_await:Eio_utils.Dla.prepare_for_await
~while_running:(fun () ->
fork ~new_fiber (fun () ->
Eio_unix.Private.Thread_pool.run t.thread_pool @@ fun () ->
Expand Down
Loading