File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ let abandon_yielded_and_paused () =
2222
2323type Runtime_events.User.tag + = Scheduler_call
2424let sch_call = Runtime_events.User. register " lwt-sch-call" Scheduler_call Runtime_events.Type. span
25+
2526type Runtime_events.User.tag + = Scheduler_lap
2627let sch_lap = Runtime_events.User. register " lwt-sch-lap" Scheduler_lap Runtime_events.Type. unit
2728
@@ -37,14 +38,12 @@ let run p =
3738 (Lwt.Private.Multidomain_sync. register_notification[@ alert " -trespassing" ]) domain(fun () -> Lwt_unix. send_notification n)
3839 end
3940 in
40- Runtime_events.User. write sch_call Begin ;
4141 let rec run_loop () =
4242 Runtime_events.User. write sch_lap () ;
4343 Runtime_events.User. write Lwt_unix. unix_job_count (Domain.DLS. get Lwt_unix. job_count) ;
4444 Runtime_events.User. write (Lwt.Private. paused_count[@ alert " -trespassing" ]) (Lwt. paused_count () ) ;
4545 match Lwt. poll p with
4646 | Some x ->
47- Runtime_events.User. write sch_call End ;
4847 x
4948 | None ->
5049 (* Call enter hooks. *)
@@ -64,7 +63,10 @@ let run p =
6463 run_loop ()
6564 in
6665
67- run_loop ()
66+ Runtime_events.User. write sch_call Begin ;
67+ Fun. protect
68+ ~finally: (fun () -> Runtime_events.User. write sch_call End )
69+ (fun () -> run_loop () )
6870
6971let run_already_called = Domain.DLS. new_key (fun () -> `No )
7072let run_already_called_mutex = Domain.DLS. new_key (fun () -> Mutex. create () )
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ open Lwt.Infix
1414
1515type Runtime_events.User.tag + = Unix_job_count
1616let unix_job_count = Runtime_events.User. register " lwt-unix-job-count" Unix_job_count Runtime_events.Type. int
17+
1718let job_count = Domain.DLS. new_key (fun () -> 0 )
1819
1920(* +-----------------------------------------------------------------+
You can’t perform that action at this time.
0 commit comments