src/Pure/Concurrent/isabelle_thread.ML
author wenzelm
Wed, 11 Oct 2023 11:27:01 +0200
changeset 78757 a094bf81a496
parent 78755 42e48ad59cda
child 78762 89202852e52c
permissions -rw-r--r--
clarified signature;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
71692
f8e52c0152fe clarified names;
wenzelm
parents: 64557
diff changeset
     1
(*  Title:      Pure/Concurrent/isabelle_thread.ML
28241
de20fccf6509 Simplified thread fork interface.
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
de20fccf6509 Simplified thread fork interface.
wenzelm
parents:
diff changeset
     3
71692
f8e52c0152fe clarified names;
wenzelm
parents: 64557
diff changeset
     4
Isabelle-specific thread management.
28241
de20fccf6509 Simplified thread fork interface.
wenzelm
parents:
diff changeset
     5
*)
de20fccf6509 Simplified thread fork interface.
wenzelm
parents:
diff changeset
     6
71692
f8e52c0152fe clarified names;
wenzelm
parents: 64557
diff changeset
     7
signature ISABELLE_THREAD =
28241
de20fccf6509 Simplified thread fork interface.
wenzelm
parents:
diff changeset
     8
sig
78648
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
     9
  type T
78650
47d0c333d155 clarified signature: retain original Poly/ML names Thread.Thread, Thread.Mutex, Thread.ConditionVar and de-emphasize them for Isabelle/ML;
wenzelm
parents: 78648
diff changeset
    10
  val get_thread: T -> Thread.Thread.thread
78648
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    11
  val get_name: T -> string
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    12
  val get_id: T -> int
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    13
  val equal: T * T -> bool
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    14
  val print: T -> string
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    15
  val self: unit -> T
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    16
  val is_self: T -> bool
78711
3a3a70d4d422 clarified order of modules: early access to interrupt management of Isabelle_Threads;
wenzelm
parents: 78704
diff changeset
    17
  val threads_stack_limit: real Unsynchronized.ref
78753
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
    18
  val default_stack_limit: unit -> int option
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
    19
  type params
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
    20
  val params: string -> params
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
    21
  val stack_limit: int -> params -> params
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
    22
  val interrupts: params -> params
78650
47d0c333d155 clarified signature: retain original Poly/ML names Thread.Thread, Thread.Mutex, Thread.ConditionVar and de-emphasize them for Isabelle/ML;
wenzelm
parents: 78648
diff changeset
    23
  val attributes: params -> Thread.Thread.threadAttribute list
78648
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    24
  val fork: params -> (unit -> unit) -> T
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    25
  val is_active: T -> bool
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    26
  val join: T -> unit
78681
38fe769658be clarified modules;
wenzelm
parents: 78678
diff changeset
    27
  val interrupt: exn
38fe769658be clarified modules;
wenzelm
parents: 78678
diff changeset
    28
  val interrupt_exn: 'a Exn.result
38fe769658be clarified modules;
wenzelm
parents: 78678
diff changeset
    29
  val interrupt_self: unit -> 'a
38fe769658be clarified modules;
wenzelm
parents: 78678
diff changeset
    30
  val interrupt_other: T -> unit
78715
9506b852ebdf clarified signature: distinction of unmanaged vs. managed interrupts (not implemented yet);
wenzelm
parents: 78714
diff changeset
    31
  structure Exn: EXN
78714
eb2255d241da clarified signature;
wenzelm
parents: 78713
diff changeset
    32
  val expose_interrupt_result: unit -> unit Exn.result
78740
45ff003d337c discontinue obsolete "Interrupt" constructor (NB: catch-all pattern produces ML compiler error);
wenzelm
parents: 78720
diff changeset
    33
  val expose_interrupt: unit -> unit  (*exception Exn.is_interrupt*)
78701
c7b2697094ac more general ML_Antiquotation.special_form;
wenzelm
parents: 78688
diff changeset
    34
  val try_catch: (unit -> 'a) -> (exn -> 'a) -> 'a
c7b2697094ac more general ML_Antiquotation.special_form;
wenzelm
parents: 78688
diff changeset
    35
  val try_finally: (unit -> 'a) -> (unit -> unit) -> 'a
78688
ff7db9055002 clarified signature;
wenzelm
parents: 78681
diff changeset
    36
  val try: (unit -> 'a) -> 'a option
ff7db9055002 clarified signature;
wenzelm
parents: 78681
diff changeset
    37
  val can: (unit -> 'a) -> bool
28241
de20fccf6509 Simplified thread fork interface.
wenzelm
parents:
diff changeset
    38
end;
de20fccf6509 Simplified thread fork interface.
wenzelm
parents:
diff changeset
    39
71692
f8e52c0152fe clarified names;
wenzelm
parents: 64557
diff changeset
    40
structure Isabelle_Thread: ISABELLE_THREAD =
28241
de20fccf6509 Simplified thread fork interface.
wenzelm
parents:
diff changeset
    41
struct
de20fccf6509 Simplified thread fork interface.
wenzelm
parents:
diff changeset
    42
78648
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    43
(* abstract type *)
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    44
78650
47d0c333d155 clarified signature: retain original Poly/ML names Thread.Thread, Thread.Mutex, Thread.ConditionVar and de-emphasize them for Isabelle/ML;
wenzelm
parents: 78648
diff changeset
    45
abstype T = T of {thread: Thread.Thread.thread, name: string, id: int}
78648
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    46
with
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    47
  val make = T;
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    48
  fun dest (T args) = args;
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    49
end;
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    50
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    51
val get_thread = #thread o dest;
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    52
val get_name = #name o dest;
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    53
val get_id = #id o dest;
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    54
78711
3a3a70d4d422 clarified order of modules: early access to interrupt management of Isabelle_Threads;
wenzelm
parents: 78704
diff changeset
    55
fun equal (t1, t2) = Thread.Thread.equal (get_thread t1, get_thread t2);
78648
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    56
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    57
fun print t =
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    58
  (case get_name t of "" => "ML" | a => "Isabelle." ^ a) ^
78711
3a3a70d4d422 clarified order of modules: early access to interrupt management of Isabelle_Threads;
wenzelm
parents: 78704
diff changeset
    59
    "-" ^ Int.toString (get_id t);
78648
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    60
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    61
60764
b610ba36e02c more explicit thread identification;
wenzelm
parents: 59468
diff changeset
    62
(* self *)
b610ba36e02c more explicit thread identification;
wenzelm
parents: 59468
diff changeset
    63
78648
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    64
val make_id = Counter.make ();
60764
b610ba36e02c more explicit thread identification;
wenzelm
parents: 59468
diff changeset
    65
b610ba36e02c more explicit thread identification;
wenzelm
parents: 59468
diff changeset
    66
local
78648
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    67
  val self_var = Thread_Data.var () : T Thread_Data.var;
60764
b610ba36e02c more explicit thread identification;
wenzelm
parents: 59468
diff changeset
    68
in
b610ba36e02c more explicit thread identification;
wenzelm
parents: 59468
diff changeset
    69
78678
wenzelm
parents: 78677
diff changeset
    70
fun init_self args =
wenzelm
parents: 78677
diff changeset
    71
  let val t = make args in Thread_Data.put self_var (SOME t); t end;
60830
f56e189350b2 separate channel for debugger output;
wenzelm
parents: 60829
diff changeset
    72
78648
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    73
fun self () =
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    74
  (case Thread_Data.get self_var of
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    75
    SOME t => t
78678
wenzelm
parents: 78677
diff changeset
    76
  | NONE => init_self {thread = Thread.Thread.self (), name = "", id = make_id ()});
78648
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    77
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
    78
fun is_self t = equal (t, self ());
60764
b610ba36e02c more explicit thread identification;
wenzelm
parents: 59468
diff changeset
    79
b610ba36e02c more explicit thread identification;
wenzelm
parents: 59468
diff changeset
    80
end;
b610ba36e02c more explicit thread identification;
wenzelm
parents: 59468
diff changeset
    81
b610ba36e02c more explicit thread identification;
wenzelm
parents: 59468
diff changeset
    82
b610ba36e02c more explicit thread identification;
wenzelm
parents: 59468
diff changeset
    83
(* fork *)
b610ba36e02c more explicit thread identification;
wenzelm
parents: 59468
diff changeset
    84
78711
3a3a70d4d422 clarified order of modules: early access to interrupt management of Isabelle_Threads;
wenzelm
parents: 78704
diff changeset
    85
val threads_stack_limit = Unsynchronized.ref 0.25;
3a3a70d4d422 clarified order of modules: early access to interrupt management of Isabelle_Threads;
wenzelm
parents: 78704
diff changeset
    86
78753
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
    87
fun default_stack_limit () =
71883
44ba78056790 clarified signature;
wenzelm
parents: 71694
diff changeset
    88
  let
78711
3a3a70d4d422 clarified order of modules: early access to interrupt management of Isabelle_Threads;
wenzelm
parents: 78704
diff changeset
    89
    val limit = Real.floor (! threads_stack_limit * 1024.0 * 1024.0 * 1024.0);
3a3a70d4d422 clarified order of modules: early access to interrupt management of Isabelle_Threads;
wenzelm
parents: 78704
diff changeset
    90
  in if limit <= 0 then NONE else SOME limit end;
71883
44ba78056790 clarified signature;
wenzelm
parents: 71694
diff changeset
    91
78753
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
    92
abstype params = Params of {name: string, stack_limit: int option, interrupts: bool}
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
    93
with
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
    94
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
    95
fun make_params (name, stack_limit, interrupts) =
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
    96
  Params {name = name, stack_limit = stack_limit, interrupts = interrupts};
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
    97
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
    98
fun params name = make_params (name, default_stack_limit (), false);
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
    99
fun stack_limit limit (Params {name, interrupts, ...}) = make_params (name, SOME limit, interrupts);
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
   100
fun interrupts (Params {name, stack_limit, ...}) = make_params (name, stack_limit, true);
60764
b610ba36e02c more explicit thread identification;
wenzelm
parents: 59468
diff changeset
   101
78753
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
   102
fun params_name (Params {name, ...}) = name;
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
   103
fun params_stack_limit (Params {stack_limit, ...}) = stack_limit;
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
   104
fun params_interrupts (Params {interrupts, ...}) = interrupts;
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
   105
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
   106
end;
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
   107
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
   108
fun attributes params =
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
   109
  Thread.Thread.MaximumMLStack (params_stack_limit params) ::
64557
37074e22e8be more tight thread attributes, based in internal word arithmetic instead of symbolic datatypes: measurable performance improvement;
wenzelm
parents: 62923
diff changeset
   110
  Thread_Attributes.convert_attributes
78753
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
   111
    (if params_interrupts params
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
   112
     then Thread_Attributes.public_interrupts
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
   113
     else Thread_Attributes.no_interrupts);
59468
fe6651760643 explicit threads_stack_limit (for recent Poly/ML SVN versions), which leads to soft interrupt instead of exhaustion of virtual memory, which is particularly relevant for the bigger address space of x86_64;
wenzelm
parents: 59055
diff changeset
   114
78753
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
   115
fun fork params body =
78648
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
   116
  let
78677
1b9e0f74addb more robust: prefer linear data flow;
wenzelm
parents: 78650
diff changeset
   117
    val self = Single_Assignment.var "self";
1b9e0f74addb more robust: prefer linear data flow;
wenzelm
parents: 78650
diff changeset
   118
    fun main () =
1b9e0f74addb more robust: prefer linear data flow;
wenzelm
parents: 78650
diff changeset
   119
      let
78753
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
   120
        val name = params_name params;
f40b59292288 clarified signature;
wenzelm
parents: 78740
diff changeset
   121
        val t = init_self {thread = Thread.Thread.self (), name = name, id = make_id ()};
78677
1b9e0f74addb more robust: prefer linear data flow;
wenzelm
parents: 78650
diff changeset
   122
        val _ = Single_Assignment.assign self t;
1b9e0f74addb more robust: prefer linear data flow;
wenzelm
parents: 78650
diff changeset
   123
      in body () end;
1b9e0f74addb more robust: prefer linear data flow;
wenzelm
parents: 78650
diff changeset
   124
    val _ = Thread.Thread.fork (main, attributes params);
1b9e0f74addb more robust: prefer linear data flow;
wenzelm
parents: 78650
diff changeset
   125
  in Single_Assignment.await self end;
28241
de20fccf6509 Simplified thread fork interface.
wenzelm
parents:
diff changeset
   126
60764
b610ba36e02c more explicit thread identification;
wenzelm
parents: 59468
diff changeset
   127
b610ba36e02c more explicit thread identification;
wenzelm
parents: 59468
diff changeset
   128
(* join *)
b610ba36e02c more explicit thread identification;
wenzelm
parents: 59468
diff changeset
   129
78650
47d0c333d155 clarified signature: retain original Poly/ML names Thread.Thread, Thread.Mutex, Thread.ConditionVar and de-emphasize them for Isabelle/ML;
wenzelm
parents: 78648
diff changeset
   130
val is_active = Thread.Thread.isActive o get_thread;
78648
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
   131
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
   132
fun join t =
852ec09aef13 more explicit type Isabelle_Thread.T;
wenzelm
parents: 78647
diff changeset
   133
  while is_active t
52583
0a7240d88e09 explicit shutdown of message output thread;
wenzelm
parents: 49894
diff changeset
   134
  do OS.Process.sleep (seconds 0.1);
0a7240d88e09 explicit shutdown of message output thread;
wenzelm
parents: 49894
diff changeset
   135
60764
b610ba36e02c more explicit thread identification;
wenzelm
parents: 59468
diff changeset
   136
78681
38fe769658be clarified modules;
wenzelm
parents: 78678
diff changeset
   137
(* interrupts *)
60764
b610ba36e02c more explicit thread identification;
wenzelm
parents: 59468
diff changeset
   138
78681
38fe769658be clarified modules;
wenzelm
parents: 78678
diff changeset
   139
val interrupt = Thread.Thread.Interrupt;
38fe769658be clarified modules;
wenzelm
parents: 78678
diff changeset
   140
val interrupt_exn = Exn.Exn interrupt;
38fe769658be clarified modules;
wenzelm
parents: 78678
diff changeset
   141
38fe769658be clarified modules;
wenzelm
parents: 78678
diff changeset
   142
fun interrupt_self () = raise interrupt;
38fe769658be clarified modules;
wenzelm
parents: 78678
diff changeset
   143
38fe769658be clarified modules;
wenzelm
parents: 78678
diff changeset
   144
fun interrupt_other t =
78650
47d0c333d155 clarified signature: retain original Poly/ML names Thread.Thread, Thread.Mutex, Thread.ConditionVar and de-emphasize them for Isabelle/ML;
wenzelm
parents: 78648
diff changeset
   145
  Thread.Thread.interrupt (get_thread t) handle Thread.Thread _ => ();
28550
422e9bd169ac added fail-safe interrupt;
wenzelm
parents: 28241
diff changeset
   146
78715
9506b852ebdf clarified signature: distinction of unmanaged vs. managed interrupts (not implemented yet);
wenzelm
parents: 78714
diff changeset
   147
structure Exn: EXN =
9506b852ebdf clarified signature: distinction of unmanaged vs. managed interrupts (not implemented yet);
wenzelm
parents: 78714
diff changeset
   148
struct
9506b852ebdf clarified signature: distinction of unmanaged vs. managed interrupts (not implemented yet);
wenzelm
parents: 78714
diff changeset
   149
  open Exn;
9506b852ebdf clarified signature: distinction of unmanaged vs. managed interrupts (not implemented yet);
wenzelm
parents: 78714
diff changeset
   150
  val capture = capture0;
78757
a094bf81a496 clarified signature;
wenzelm
parents: 78755
diff changeset
   151
  fun capture_body e = capture e ();
78715
9506b852ebdf clarified signature: distinction of unmanaged vs. managed interrupts (not implemented yet);
wenzelm
parents: 78714
diff changeset
   152
end;
9506b852ebdf clarified signature: distinction of unmanaged vs. managed interrupts (not implemented yet);
wenzelm
parents: 78714
diff changeset
   153
78714
eb2255d241da clarified signature;
wenzelm
parents: 78713
diff changeset
   154
fun expose_interrupt_result () =
78713
a44ac17ae227 clarified modules;
wenzelm
parents: 78711
diff changeset
   155
  let
a44ac17ae227 clarified modules;
wenzelm
parents: 78711
diff changeset
   156
    val orig_atts = Thread_Attributes.safe_interrupts (Thread_Attributes.get_attributes ());
78755
42e48ad59cda more robust: avoid race condition;
wenzelm
parents: 78753
diff changeset
   157
    fun main () =
42e48ad59cda more robust: avoid race condition;
wenzelm
parents: 78753
diff changeset
   158
      (Thread_Attributes.set_attributes Thread_Attributes.test_interrupts;
42e48ad59cda more robust: avoid race condition;
wenzelm
parents: 78753
diff changeset
   159
       Thread.Thread.testInterrupt ());
78757
a094bf81a496 clarified signature;
wenzelm
parents: 78755
diff changeset
   160
    val test = Exn.capture_body main;
78713
a44ac17ae227 clarified modules;
wenzelm
parents: 78711
diff changeset
   161
    val _ = Thread_Attributes.set_attributes orig_atts;
78714
eb2255d241da clarified signature;
wenzelm
parents: 78713
diff changeset
   162
  in test end;
eb2255d241da clarified signature;
wenzelm
parents: 78713
diff changeset
   163
eb2255d241da clarified signature;
wenzelm
parents: 78713
diff changeset
   164
val expose_interrupt = Exn.release o expose_interrupt_result;
78713
a44ac17ae227 clarified modules;
wenzelm
parents: 78711
diff changeset
   165
78701
c7b2697094ac more general ML_Antiquotation.special_form;
wenzelm
parents: 78688
diff changeset
   166
fun try_catch e f =
78720
909dc00766a0 clarified signature;
wenzelm
parents: 78716
diff changeset
   167
  Thread_Attributes.uninterruptible_body (fn run =>
909dc00766a0 clarified signature;
wenzelm
parents: 78716
diff changeset
   168
    run e () handle exn => if Exn.is_interrupt exn then Exn.reraise exn else f exn);
78701
c7b2697094ac more general ML_Antiquotation.special_form;
wenzelm
parents: 78688
diff changeset
   169
c7b2697094ac more general ML_Antiquotation.special_form;
wenzelm
parents: 78688
diff changeset
   170
fun try_finally e f =
78720
909dc00766a0 clarified signature;
wenzelm
parents: 78716
diff changeset
   171
  Thread_Attributes.uninterruptible_body (fn run =>
78757
a094bf81a496 clarified signature;
wenzelm
parents: 78755
diff changeset
   172
    Exn.release (Exn.capture_body (run e) before f ()));
78701
c7b2697094ac more general ML_Antiquotation.special_form;
wenzelm
parents: 78688
diff changeset
   173
78688
ff7db9055002 clarified signature;
wenzelm
parents: 78681
diff changeset
   174
fun try e = Basics.try e ();
ff7db9055002 clarified signature;
wenzelm
parents: 78681
diff changeset
   175
fun can e = Basics.can e ();
ff7db9055002 clarified signature;
wenzelm
parents: 78681
diff changeset
   176
28241
de20fccf6509 Simplified thread fork interface.
wenzelm
parents:
diff changeset
   177
end;
78715
9506b852ebdf clarified signature: distinction of unmanaged vs. managed interrupts (not implemented yet);
wenzelm
parents: 78714
diff changeset
   178
9506b852ebdf clarified signature: distinction of unmanaged vs. managed interrupts (not implemented yet);
wenzelm
parents: 78714
diff changeset
   179
structure Exn = Isabelle_Thread.Exn;