Implement keep-going (-k) option.
[goals.git] / src / jobs.mli
index a5b79bb..9be4186 100644 (file)
 
 type 'a next = Job of 'a * (unit -> unit) | Complete | Not_ready
 
-val run : (unit -> 'a next) -> ('a -> unit) -> ('a -> string) -> unit
-(** [run next_job retire_job to_string] runs jobs in parallel.
+val run : (unit -> 'a next) -> ('a -> unit) -> ('a -> unit) ->
+          ('a -> string) -> unit
+(** [run next_job retire_job fail_job to_string] runs jobs in parallel.
 
     [next_job] is called to pick the next available job.
     [retire_job] is called when a job finishes successfully.
+    [fail_job] is called when a job fails (only in keep-going
+    -k mode).  All jobs that depend on this one must be marked
+    failed by the caller.
     [to_string] is called if we need to print the job name.
 
     If [next_job] returns [Job f] then that function is started
     (usually in a thread if -j N > 1).
 
     If [next_job] returns [Complete] then [run] waits until
-    all parallel jobs are then returns.
+    all parallel jobs are finished then returns.
 
     If [next_job] returns [Not_ready] then [next_job] will be
     called again after a little while.
@@ -40,4 +44,5 @@ val run : (unit -> 'a next) -> ('a -> unit) -> ('a -> string) -> unit
     If any job throws an exception then the exception will be
     reraised by [run], usually causing goals to exit with an error.
     The exception is delayed until all currently running jobs
-    finish, but no new jobs will be started during this time. *)
+    finish.  In normal mode no new jobs will be started during
+    this time.  In keep-going -k mode new jobs may be started. *)