X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=src%2Fjobs.ml;h=2e8735e4b0a7bed699ab42c8be5fc36f6659a449;hb=ff4a8c81429495ae914d0dbeef9dbb50b2b1a00c;hp=085d4660c175772f0f87814cf176eaf5210fb58a;hpb=a70987f316ab4b948bf941ddea8fb6ccef09da4f;p=goals.git diff --git a/src/jobs.ml b/src/jobs.ml index 085d466..2e8735e 100644 --- a/src/jobs.ml +++ b/src/jobs.ml @@ -52,13 +52,7 @@ let run next_job retire_job string_of_job = let rec loop () = if !last_exn = None then ( match next_job () with - | Complete -> - if !running > 0 then ( - Cmdline.debug "%d/%d threads running, waiting for completion" - !running (Cmdline.nr_jobs ()); - Condition.wait cond lock; - loop () - ) + | Complete -> () | Not_ready -> assert (!running > 0); Cmdline.debug "%d/%d threads running, waiting for dependencies" @@ -80,6 +74,14 @@ let run next_job retire_job string_of_job = in Mutex.lock lock; loop (); + + (* Wait for all jobs to complete. *) + while !running > 0 do + Cmdline.debug "%d/%d threads running, waiting for completion" + !running (Cmdline.nr_jobs ()); + Condition.wait cond lock + done; + let exn = !last_exn in Mutex.unlock lock;