Skip to content

Commit

Permalink
TEMP: printf
Browse files Browse the repository at this point in the history
  • Loading branch information
c-cube committed Feb 9, 2024
1 parent 03676f2 commit 43cd603
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/fib/fiber.ml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ let k_current_fiber : any option Task_local_storage.key =
Task_local_storage.new_key ~init:(fun () -> None) ()

let spawn_ ?name ~on (f : _ -> 'a) : 'a t =
Printf.printf "spawn fiber\n%!";
let id = Handle.generate_fresh () in
let res, _promise = Fut.make ?name () in
let fib =
Expand All @@ -162,8 +163,10 @@ let spawn_ ?name ~on (f : _ -> 'a) : 'a t =

let run () =
(* make sure the fiber is accessible from inside itself *)
Printf.printf "run fiber 0\n%!";
Task_local_storage.set k_current_fiber (Some (Any fib));
try
Printf.printf "run fiber\n%!";
let res = f () in
resolve_ok_ fib res
with exn ->
Expand Down
4 changes: 4 additions & 0 deletions src/unix/ev_loop.ml
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,18 @@ module Ev_loop = struct

let delay = run_timer_ self.timer in
let delay = Option.value delay ~default:10. in
Printf.printf "delay: %f\n%!" delay;

(* run [select] *)
let reads, writes = IO_tbl.prepare_select self.io_tbl in
A.set self.in_blocking_section true;
Printf.printf "ENTER (%d read, %d write)\n%!" (List.length reads)
(List.length writes);
let reads, writes, _ =
let@ _sp = Tracing_.with_span "moonpool-unix.select" in
Unix.select (self.pipe_read :: reads) writes [] delay
in
Printf.printf "EXIT\n%!";
A.set self.in_blocking_section false;

drain_pipe_ self;
Expand Down

0 comments on commit 43cd603

Please sign in to comment.