src/Pure/PIDE/command.ML
changeset 59466 6fab87db556c
parent 59348 8a6788917b32
child 59472 513300fa2d09
equal deleted inserted replaced
59465:c21b65a6834b 59466:6fab87db556c
    36 structure Command: COMMAND =
    36 structure Command: COMMAND =
    37 struct
    37 struct
    38 
    38 
    39 (** main phases of execution **)
    39 (** main phases of execution **)
    40 
    40 
       
    41 fun task_context group f =
       
    42   f
       
    43   |> Future.interruptible_task
       
    44   |> Future.task_context "Command.run_process" group;
       
    45 
       
    46 
    41 (* read *)
    47 (* read *)
    42 
    48 
    43 type blob =
    49 type blob =
    44   (string * (SHA1.digest * string list) option) Exn.result;  (*file node name, digest, lines*)
    50   (string * (SHA1.digest * string list) option) Exn.result;  (*file node name, digest, lines*)
    45 
    51 
   141 val eval_eq = op = o apply2 eval_exec_id;
   147 val eval_eq = op = o apply2 eval_exec_id;
   142 
   148 
   143 val eval_running = Execution.is_running_exec o eval_exec_id;
   149 val eval_running = Execution.is_running_exec o eval_exec_id;
   144 fun eval_finished (Eval {eval_process, ...}) = Lazy.is_finished eval_process;
   150 fun eval_finished (Eval {eval_process, ...}) = Lazy.is_finished eval_process;
   145 
   151 
   146 fun eval_result (Eval {eval_process, ...}) = Lazy.force eval_process;
   152 fun eval_result (Eval {eval_process, ...}) =
       
   153   task_context (Future.worker_subgroup ()) Lazy.force eval_process;
       
   154 
   147 val eval_result_state = #state o eval_result;
   155 val eval_result_state = #state o eval_result;
   148 
   156 
   149 local
   157 local
   150 
   158 
   151 fun reset_state keywords tr st0 = Toplevel.setmp_thread_position tr (fn () =>
   159 fun reset_state keywords tr st0 = Toplevel.setmp_thread_position tr (fn () =>
   367 local
   375 local
   368 
   376 
   369 fun run_process execution_id exec_id process =
   377 fun run_process execution_id exec_id process =
   370   let val group = Future.worker_subgroup () in
   378   let val group = Future.worker_subgroup () in
   371     if Execution.running execution_id exec_id [group] then
   379     if Execution.running execution_id exec_id [group] then
   372       ignore (Future.task_context "Command.run_process" group Lazy.force_result process)
   380       ignore (task_context group Lazy.force_result process)
   373     else ()
   381     else ()
   374   end;
   382   end;
   375 
   383 
   376 fun ignore_process process =
   384 fun ignore_process process =
   377   Lazy.is_running process orelse Lazy.is_finished process;
   385   Lazy.is_running process orelse Lazy.is_finished process;