src/Pure/Thy/thy_info.ML
changeset 28126 7332b623b569
parent 27843 0bd68bf0cbb8
child 28194 c6dad24124f1
equal deleted inserted replaced
28125:e99427bcf7f3 28126:7332b623b569
   327     val tasks = Graph.minimals G |> map (fn name =>
   327     val tasks = Graph.minimals G |> map (fn name =>
   328       (name, (Graph.get_node G name, length (Graph.imm_succs G name))));
   328       (name, (Graph.get_node G name, length (Graph.imm_succs G name))));
   329     val finished = filter (task_finished o fst o snd) tasks;
   329     val finished = filter (task_finished o fst o snd) tasks;
   330   in
   330   in
   331     if not (null finished) then next_task (Graph.del_nodes (map fst finished) G)
   331     if not (null finished) then next_task (Graph.del_nodes (map fst finished) G)
   332     else if null tasks then (Multithreading.Terminate, G)
   332     else if null tasks then (Schedule.Terminate, G)
   333     else
   333     else
   334       (case fold max_task tasks NONE of
   334       (case fold max_task tasks NONE of
   335         NONE => (Multithreading.Wait, G)
   335         NONE => (Schedule.Wait, G)
   336       | SOME (name, (body, _)) =>
   336       | SOME (name, (body, _)) =>
   337          (Multithreading.Task {body = PrintMode.closure body,
   337          (Schedule.Task {body = PrintMode.closure body,
   338            cont = Graph.del_nodes [name], fail = K Graph.empty},
   338            cont = Graph.del_nodes [name], fail = K Graph.empty},
   339           Graph.map_node name (K Running) G))
   339           Graph.map_node name (K Running) G))
   340   end;
   340   end;
   341 
   341 
   342 fun schedule_seq tasks =
   342 fun schedule_seq tasks =
   350     if m <= 1 orelse n <= 1 then schedule_seq tasks
   350     if m <= 1 orelse n <= 1 then schedule_seq tasks
   351     else if Multithreading.self_critical () then
   351     else if Multithreading.self_critical () then
   352      (warning (loader_msg "no multithreading within critical section" []);
   352      (warning (loader_msg "no multithreading within critical section" []);
   353       schedule_seq tasks)
   353       schedule_seq tasks)
   354     else
   354     else
   355       (case Multithreading.schedule (Int.min (m, n)) next_task tasks of
   355       (case Schedule.schedule (Int.min (m, n)) next_task tasks of
   356         [] => ()
   356         [] => ()
   357       | exns => raise Exn.EXCEPTIONS (exns, ""))
   357       | exns => raise Exn.EXCEPTIONS (exns, ""))
   358   end;
   358   end;
   359 
   359 
   360 end;
   360 end;