Skip to content

Commit

Permalink
Merge pull request #3958 from rgrinberg/remove-running-count
Browse files Browse the repository at this point in the history
[scheduler] Remove running count
  • Loading branch information
rgrinberg authored Nov 19, 2020
2 parents d39fed9 + 179d2d1 commit ac4aa91
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/dune_engine/scheduler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -421,14 +421,11 @@ end = struct
in [table]. *)
let table = Table.create (module Pid) 128

let running_count = ref 0

let add job =
match Table.find table job.pid with
| None ->
Table.set table job.pid (Running job);
incr running_count;
if !running_count = 1 then Condition.signal something_is_running_cv
if Table.length table = 1 then Condition.signal something_is_running_cv
| Some (Zombie status) ->
Table.remove table job.pid;
Event.send_job_completed job status
Expand All @@ -438,7 +435,6 @@ end = struct
match Table.find table pid with
| None -> Table.set table pid (Zombie status)
| Some (Running job) ->
decr running_count;
Table.remove table pid;
Event.send_job_completed job status
| Some (Zombie _) -> assert false
Expand All @@ -449,7 +445,7 @@ end = struct
| Running job -> f job
| Zombie _ -> ())

let running_count () = !running_count
let running_count () = Table.length table
end

let register_job job =
Expand Down

0 comments on commit ac4aa91

Please sign in to comment.