Skip to content

Commit

Permalink
Tidy up some naming
Browse files Browse the repository at this point in the history
  • Loading branch information
patricoferris committed Feb 27, 2024
1 parent e70709a commit 19e8d57
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions example/burn.ml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
open Eio

let woops_sleepy ~clock =
Eio_name.name "sleeper";
Switch.run ~name:"sleeper" @@ fun sw ->
Switch.run ~name:"unix sleeper ctx" @@ fun sw ->
Fiber.fork ~sw (fun () ->
Eio_name.name "unix sleeper";
(* Woops! Wrong sleep function, we blocked the fiber *)
Expand All @@ -16,7 +15,7 @@ let spawn ~clock min max =
for _i = 0 to 100 do
ignore (Sys.opaque_identity @@ Array.init 1000000 float_of_int)
done;
Switch.run @@ fun sw ->
Switch.run ~name:"spawn ctx" @@ fun sw ->
for i = min to max do
Fiber.fork ~sw (fun () ->
Eio_name.name (Fmt.str "worker>%d" i);
Expand All @@ -37,6 +36,7 @@ let spawn ~clock min max =
let main clock =
let p, r = Promise.create () in
Switch.run ~name:"main" @@ fun sw ->
Eio_name.name "main fiber";
(* A long running task *)
Fiber.fork ~sw (fun () ->
Eio_name.name "waiter";
Expand Down
4 changes: 3 additions & 1 deletion src/lib/meio.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ let task_events ~latency_begin ~latency_end q =
| `Create (fiber, `Fiber_in parent) ->
Queue.push q (`Created ((fiber :> int), parent, d, ts, e))
| `Create (id, `Cc _) ->
Queue.push q (`Created ((id :> int), !current_id, d, ts, e))
Queue.push q (`Created ((id :> int), !current_id, d, ts, e));
(* Bit of a hack -- eio could label this for us? *)
if id = 0 then Queue.push q (`Name (id, "root"))
| `Suspend_fiber _ ->
current_id := -1;
Queue.push q (`Suspend (d, ts))
Expand Down

0 comments on commit 19e8d57

Please sign in to comment.