src/Pure/Concurrent/multithreading.ML
changeset 68025 7fb7a6366a40
parent 67659 11b390e971f6
child 68130 6fb85346cb79
equal deleted inserted replaced
68024:b5e29bf0aeab 68025:7fb7a6366a40
     8 sig
     8 sig
     9   val max_threads: unit -> int
     9   val max_threads: unit -> int
    10   val max_threads_update: int -> unit
    10   val max_threads_update: int -> unit
    11   val enabled: unit -> bool
    11   val enabled: unit -> bool
    12   val relevant: 'a list -> bool
    12   val relevant: 'a list -> bool
       
    13   val parallel_proofs: int ref
       
    14   val parallel_proofs_enabled: int -> bool
    13   val sync_wait: Time.time option -> ConditionVar.conditionVar -> Mutex.mutex -> bool Exn.result
    15   val sync_wait: Time.time option -> ConditionVar.conditionVar -> Mutex.mutex -> bool Exn.result
    14   val trace: int ref
    16   val trace: int ref
    15   val tracing: int -> (unit -> string) -> unit
    17   val tracing: int -> (unit -> string) -> unit
    16   val tracing_time: bool -> Time.time -> (unit -> string) -> unit
    18   val tracing_time: bool -> Time.time -> (unit -> string) -> unit
    17   val synchronized: string -> Mutex.mutex -> (unit -> 'a) -> 'a
    19   val synchronized: string -> Mutex.mutex -> (unit -> 'a) -> 'a
    43 fun enabled () = max_threads () > 1;
    45 fun enabled () = max_threads () > 1;
    44 
    46 
    45 val relevant = (fn [] => false | [_] => false | _ => enabled ());
    47 val relevant = (fn [] => false | [_] => false | _ => enabled ());
    46 
    48 
    47 end;
    49 end;
       
    50 
       
    51 
       
    52 (* parallel_proofs *)
       
    53 
       
    54 val parallel_proofs = ref 1;
       
    55 
       
    56 fun parallel_proofs_enabled n =
       
    57   enabled () andalso ! parallel_proofs >= n;
    48 
    58 
    49 
    59 
    50 (* synchronous wait *)
    60 (* synchronous wait *)
    51 
    61 
    52 fun sync_wait time cond lock =
    62 fun sync_wait time cond lock =