equal
deleted
inserted
replaced
218 (* Set up a Watcher Process *) |
218 (* Set up a Watcher Process *) |
219 (*************************************) |
219 (*************************************) |
220 |
220 |
221 fun getProofCmd (a,c,d,e,f) = d |
221 fun getProofCmd (a,c,d,e,f) = d |
222 |
222 |
|
223 (* for tracing: encloses each string element in brackets. *) |
|
224 val concat_with_and = space_implode " & " o map (enclose "(" ")"); |
|
225 |
223 fun prems_string_of th = |
226 fun prems_string_of th = |
224 Meson.concat_with_and (map (Sign.string_of_term (sign_of_thm th)) (prems_of th)) |
227 concat_with_and (map (Sign.string_of_term (sign_of_thm th)) (prems_of th)) |
225 |
228 |
226 fun killChild proc = (Unix.kill(proc, Posix.Signal.kill); Unix.reap proc); |
229 fun killChild proc = (Unix.kill(proc, Posix.Signal.kill); Unix.reap proc); |
227 |
230 |
228 fun killChildren procs = List.app (ignore o killChild) procs; |
231 fun killChildren procs = List.app (ignore o killChild) procs; |
229 |
232 |
322 in |
325 in |
323 if childDone |
326 if childDone |
324 then (* child has found a proof and transferred it *) |
327 then (* child has found a proof and transferred it *) |
325 (* Remove this child and go on to check others*) |
328 (* Remove this child and go on to check others*) |
326 (Unix.reap child_handle; |
329 (Unix.reap child_handle; |
|
330 OS.FileSys.remove childCmd; |
327 checkChildren(otherChildren, toParentStr)) |
331 checkChildren(otherChildren, toParentStr)) |
328 else (* Keep this child and go on to check others *) |
332 else (* Keep this child and go on to check others *) |
329 childProc :: checkChildren (otherChildren, toParentStr) |
333 childProc :: checkChildren (otherChildren, toParentStr) |
330 end |
334 end |
331 else (trace "\nNo child output"; |
335 else (trace "\nNo child output"; |
517 let val (childpid,(childin,childout)) = childInfo (setupWatcher(thm,clause_arr)) |
521 let val (childpid,(childin,childout)) = childInfo (setupWatcher(thm,clause_arr)) |
518 fun decr_watched() = |
522 fun decr_watched() = |
519 (goals_being_watched := !goals_being_watched - 1; |
523 (goals_being_watched := !goals_being_watched - 1; |
520 if !goals_being_watched = 0 |
524 if !goals_being_watched = 0 |
521 then |
525 then |
522 (trace ("\nReaping a watcher, childpid = "^ |
526 (debug ("\nReaping a watcher, childpid = "^ |
523 LargeWord.toString (Posix.Process.pidToWord childpid)); |
527 LargeWord.toString (Posix.Process.pidToWord childpid)); |
524 killWatcher childpid; reapWatcher (childpid,childin, childout)) |
528 killWatcher childpid; reapWatcher (childpid,childin, childout)) |
525 else ()) |
529 else ()) |
526 val _ = debug ("subgoals forked to createWatcher: "^ prems_string_of thm); |
530 val _ = debug ("subgoals forked to createWatcher: "^ prems_string_of thm); |
527 fun proofHandler n = |
531 fun proofHandler n = |