src/Pure/goal.ML
changeset 51605 eca8acb42e4a
parent 51553 63327f679cff
child 51607 ee3398dfee9a
equal deleted inserted replaced
51604:f83661733143 51605:eca8acb42e4a
    24   val protect: thm -> thm
    24   val protect: thm -> thm
    25   val conclude: thm -> thm
    25   val conclude: thm -> thm
    26   val check_finished: Proof.context -> thm -> thm
    26   val check_finished: Proof.context -> thm -> thm
    27   val finish: Proof.context -> thm -> thm
    27   val finish: Proof.context -> thm -> thm
    28   val norm_result: thm -> thm
    28   val norm_result: thm -> thm
    29   val fork_name: string -> int -> (unit -> 'a) -> 'a future
    29   val fork_params: {name: string, pos: Position.T, pri: int} -> (unit -> 'a) -> 'a future
    30   val fork: int -> (unit -> 'a) -> 'a future
    30   val fork: int -> (unit -> 'a) -> 'a future
    31   val peek_futures: serial -> unit future list
    31   val peek_futures: serial -> unit future list
    32   val reset_futures: unit -> Future.group list
    32   val reset_futures: unit -> Future.group list
    33   val shutdown_futures: unit -> unit
    33   val shutdown_futures: unit -> unit
    34   val future_enabled_level: int -> bool
    34   val future_enabled_level: int -> bool
   141   let val props = Markup.properties [(Markup.taskN, Task_Queue.str_of_task task)]
   141   let val props = Markup.properties [(Markup.taskN, Task_Queue.str_of_task task)]
   142   in Output.status (implode (map (Markup.markup_only o props) markups)) end;
   142   in Output.status (implode (map (Markup.markup_only o props) markups)) end;
   143 
   143 
   144 in
   144 in
   145 
   145 
   146 fun fork_name name pri e =
   146 fun fork_params {name, pos, pri} e =
   147   uninterruptible (fn _ => fn () =>
   147   uninterruptible (fn _ => fn () =>
   148     let
   148     let
   149       val pos = Position.thread_data ();
       
   150       val id = the_default 0 (Position.parse_id pos);
   149       val id = the_default 0 (Position.parse_id pos);
   151       val _ = count_forked 1;
   150       val _ = count_forked 1;
   152 
   151 
   153       val future =
   152       val future =
   154         (singleton o Future.forks)
   153         (singleton o Future.forks)
   174             in Exn.release result end);
   173             in Exn.release result end);
   175       val _ = status (Future.task_of future) [Markup.forked];
   174       val _ = status (Future.task_of future) [Markup.forked];
   176       val _ = register_forked id future;
   175       val _ = register_forked id future;
   177     in future end) ();
   176     in future end) ();
   178 
   177 
   179 fun fork pri e = fork_name "Goal.fork" pri e;
   178 fun fork pri e =
       
   179   fork_params {name = "Goal.fork", pos = Position.thread_data (), pri = pri} e;
   180 
   180 
   181 fun forked_count () = #1 (Synchronized.value forked_proofs);
   181 fun forked_count () = #1 (Synchronized.value forked_proofs);
   182 
   182 
   183 fun peek_futures id =
   183 fun peek_futures id =
   184   Inttab.lookup_list (#3 (Synchronized.value forked_proofs)) id;
   184   Inttab.lookup_list (#3 (Synchronized.value forked_proofs)) id;