equal
deleted
inserted
replaced
16 val cancel: Document_ID.exec -> unit |
16 val cancel: Document_ID.exec -> unit |
17 val terminate: Document_ID.exec -> unit |
17 val terminate: Document_ID.exec -> unit |
18 type params = {name: string, pos: Position.T, pri: int} |
18 type params = {name: string, pos: Position.T, pri: int} |
19 val fork: params -> (unit -> 'a) -> 'a future |
19 val fork: params -> (unit -> 'a) -> 'a future |
20 val print: params -> (serial -> unit) -> unit |
20 val print: params -> (serial -> unit) -> unit |
21 val print_report: string -> unit |
|
22 val fork_prints: Document_ID.exec -> unit |
21 val fork_prints: Document_ID.exec -> unit |
23 val purge: Document_ID.exec list -> unit |
22 val purge: Document_ID.exec list -> unit |
24 val reset: unit -> Future.group list |
23 val reset: unit -> Future.group list |
25 val shutdown: unit -> unit |
24 val shutdown: unit -> unit |
26 end; |
25 end; |
146 (case Inttab.lookup execs exec_id of |
145 (case Inttab.lookup execs exec_id of |
147 SOME (groups, prints) => Inttab.update (exec_id, (groups, print :: prints)) execs |
146 SOME (groups, prints) => Inttab.update (exec_id, (groups, print :: prints)) execs |
148 | NONE => raise Fail (unregistered exec_id)) |
147 | NONE => raise Fail (unregistered exec_id)) |
149 end)); |
148 end)); |
150 |
149 |
151 fun print_report s = |
|
152 if s = "" orelse not (Multithreading.enabled ()) then Output.direct_report s |
|
153 else |
|
154 let |
|
155 val body = YXML.parse_body s (*sharable closure!*) |
|
156 val params = {name = "", pos = Position.thread_data (), pri = 0}; |
|
157 in print params (fn _ => Output.direct_report (YXML.string_of_body body)) end; |
|
158 |
|
159 fun fork_prints exec_id = |
150 fun fork_prints exec_id = |
160 (case Inttab.lookup (#2 (get_state ())) exec_id of |
151 (case Inttab.lookup (#2 (get_state ())) exec_id of |
161 SOME (_, prints) => |
152 SOME (_, prints) => |
162 if null prints orelse null (tl prints) orelse not (Multithreading.enabled ()) |
153 if null prints orelse null (tl prints) orelse not (Multithreading.enabled ()) |
163 then List.app (fn {body, ...} => body ()) (rev prints) |
154 then List.app (fn {body, ...} => body ()) (rev prints) |