mirror of
https://github.com/ocaml-multicore/eio.git
synced 2025-07-30 00:02:24 -04:00
Compare commits
No commits in common. "4856fc430db261eb4c9e90107f0f629e1284d945" and "d338f8bc61cbe0ada91bfb8f0c751ef8a9aa5bb0" have entirely different histories.
4856fc430d
...
d338f8bc61
@ -23,7 +23,7 @@ let run_client sock =
|
|||||||
)
|
)
|
||||||
|
|
||||||
let time name service =
|
let time name service =
|
||||||
Switch.run ~name @@ fun sw ->
|
Switch.run @@ fun sw ->
|
||||||
let client_sock, server_sock = Eio_unix.Net.socketpair_stream ~sw () in
|
let client_sock, server_sock = Eio_unix.Net.socketpair_stream ~sw () in
|
||||||
let t0 = Unix.gettimeofday () in
|
let t0 = Unix.gettimeofday () in
|
||||||
Fiber.both
|
Fiber.both
|
||||||
|
@ -69,22 +69,11 @@ let fork_promise_exn ~sw f =
|
|||||||
);
|
);
|
||||||
p
|
p
|
||||||
|
|
||||||
(* Like [List.iter (fork ~sw)], but runs the last one in the current fiber
|
|
||||||
for efficiency and less cluttered traces. *)
|
|
||||||
let rec forks ~sw = function
|
|
||||||
| [] -> ()
|
|
||||||
| [x] -> Switch.check sw; x ()
|
|
||||||
| x :: xs ->
|
|
||||||
fork ~sw x;
|
|
||||||
forks ~sw xs
|
|
||||||
|
|
||||||
let all xs =
|
let all xs =
|
||||||
Switch.run ~name:"all" @@ fun sw ->
|
Switch.run ~name:"all" @@ fun sw ->
|
||||||
forks ~sw xs
|
List.iter (fork ~sw) xs
|
||||||
|
|
||||||
let both f g =
|
let both f g = all [f; g]
|
||||||
Switch.run ~name:"both" @@ fun sw ->
|
|
||||||
forks ~sw [f; g]
|
|
||||||
|
|
||||||
let pair f g =
|
let pair f g =
|
||||||
Switch.run ~name:"pair" @@ fun sw ->
|
Switch.run ~name:"pair" @@ fun sw ->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user