src/Pure/Thy/thy_info.ML
changeset 73825 5b49c650d413
parent 73821 9ead8d9be3ab
child 74561 8e6c973003c8
equal deleted inserted replaced
73824:6e9a47d3850c 73825:5b49c650d413
   195     commit = I};
   195     commit = I};
   196 
   196 
   197 fun result_theory (Result {theory, ...}) = theory;
   197 fun result_theory (Result {theory, ...}) = theory;
   198 fun result_commit (Result {commit, ...}) = commit;
   198 fun result_commit (Result {commit, ...}) = commit;
   199 
   199 
       
   200 datatype task =
       
   201   Task of string list * (theory list -> result) |
       
   202   Finished of theory;
       
   203 
       
   204 local
       
   205 
   200 fun consolidate_theory (Exn.Exn exn) = [Exn.Exn exn]
   206 fun consolidate_theory (Exn.Exn exn) = [Exn.Exn exn]
   201   | consolidate_theory (Exn.Res (Result {theory, exec_id, ...})) =
   207   | consolidate_theory (Exn.Res (Result {theory, exec_id, ...})) =
   202       let
   208       let
   203         val _ = Execution.join [exec_id];
   209         val _ = Execution.join [exec_id];
   204         val res = Exn.capture Thm.consolidate_theory theory;
   210         val res = Exn.capture Thm.consolidate_theory theory;
   210       (case present () of
   216       (case present () of
   211         NONE => []
   217         NONE => []
   212       | SOME (context as {segments, ...}) =>
   218       | SOME (context as {segments, ...}) =>
   213           [Exn.capture (fn () => (apply_presentation context theory; (theory, segments))) ()]);
   219           [Exn.capture (fn () => (apply_presentation context theory; (theory, segments))) ()]);
   214 
   220 
   215 
   221 in
   216 datatype task =
       
   217   Task of string list * (theory list -> result) |
       
   218   Finished of theory;
       
   219 
   222 
   220 val schedule_theories = Thread_Attributes.uninterruptible (fn _ => fn tasks =>
   223 val schedule_theories = Thread_Attributes.uninterruptible (fn _ => fn tasks =>
   221   let
   224   let
   222     fun join_parents deps name parents =
   225     fun join_parents deps name parents =
   223       (case map #1 (filter (not o can Future.join o #2) deps) of
   226       (case map #1 (filter (not o can Future.join o #2) deps) of
   249     val results4 = map Exn.Exn (maps Task_Queue.group_status (Execution.reset ()));
   252     val results4 = map Exn.Exn (maps Task_Queue.group_status (Execution.reset ()));
   250 
   253 
   251     val _ = Par_Exn.release_all (results1 @ results2 @ results3 @ results4);
   254     val _ = Par_Exn.release_all (results1 @ results2 @ results3 @ results4);
   252   in Par_Exn.release_all present_results end);
   255   in Par_Exn.release_all present_results end);
   253 
   256 
       
   257 end;
       
   258 
   254 
   259 
   255 (* eval theory *)
   260 (* eval theory *)
   256 
   261 
   257 fun eval_thy options master_dir header text_pos text parents =
   262 fun eval_thy options master_dir header text_pos text parents =
   258   let
   263   let