src/Pure/goal.ML
changeset 50201 c26369c9eda6
parent 49931 85780e6f8fd2
child 50911 ee7fe4230642
equal deleted inserted replaced
50200:2c94c065564e 50201:c26369c9eda6
   127       val groups' = Task_Queue.group_of_task (Future.task_of future) :: groups;
   127       val groups' = Task_Queue.group_of_task (Future.task_of future) :: groups;
   128       val tab' = Inttab.cons_list (id, Future.map (K ()) future) tab;
   128       val tab' = Inttab.cons_list (id, Future.map (K ()) future) tab;
   129     in (m, groups', tab') end);
   129     in (m, groups', tab') end);
   130 
   130 
   131 fun status task markups =
   131 fun status task markups =
   132   let val props = Markup.properties [(Isabelle_Markup.taskN, Task_Queue.str_of_task task)]
   132   let val props = Markup.properties [(Markup.taskN, Task_Queue.str_of_task task)]
   133   in Output.status (implode (map (Markup.markup_only o props) markups)) end;
   133   in Output.status (implode (map (Markup.markup_only o props) markups)) end;
   134 
   134 
   135 in
   135 in
   136 
   136 
   137 fun fork_name name e =
   137 fun fork_name name e =
   146         (singleton o Future.forks)
   146         (singleton o Future.forks)
   147           {name = name, group = NONE, deps = [], pri = ~1, interrupts = false}
   147           {name = name, group = NONE, deps = [], pri = ~1, interrupts = false}
   148           (fn () =>
   148           (fn () =>
   149             let
   149             let
   150               val task = the (Future.worker_task ());
   150               val task = the (Future.worker_task ());
   151               val _ = status task [Isabelle_Markup.running];
   151               val _ = status task [Markup.running];
   152               val result = Exn.capture (Future.interruptible_task e) ();
   152               val result = Exn.capture (Future.interruptible_task e) ();
   153               val _ = status task [Isabelle_Markup.finished, Isabelle_Markup.joined];
   153               val _ = status task [Markup.finished, Markup.joined];
   154               val _ =
   154               val _ =
   155                 (case result of
   155                 (case result of
   156                   Exn.Res _ => ()
   156                   Exn.Res _ => ()
   157                 | Exn.Exn exn =>
   157                 | Exn.Exn exn =>
   158                     if id = 0 orelse Exn.is_interrupt exn then ()
   158                     if id = 0 orelse Exn.is_interrupt exn then ()
   159                     else
   159                     else
   160                       (status task [Isabelle_Markup.failed];
   160                       (status task [Markup.failed];
   161                        Output.report (Markup.markup_only Isabelle_Markup.bad);
   161                        Output.report (Markup.markup_only Markup.bad);
   162                        Output.error_msg (ML_Compiler.exn_message exn)));
   162                        Output.error_msg (ML_Compiler.exn_message exn)));
   163               val _ = count_forked ~1;
   163               val _ = count_forked ~1;
   164             in Exn.release result end);
   164             in Exn.release result end);
   165       val _ = status (Future.task_of future) [Isabelle_Markup.forked];
   165       val _ = status (Future.task_of future) [Markup.forked];
   166       val _ = register_forked id future;
   166       val _ = register_forked id future;
   167     in future end) ();
   167     in future end) ();
   168 
   168 
   169 fun fork e = fork_name "Goal.fork" e;
   169 fun fork e = fork_name "Goal.fork" e;
   170 
   170