src/Pure/System/scala.ML
changeset 78681 38fe769658be
parent 78675 f0a4ad78c0f2
child 78716 97dfba4405e3
equal deleted inserted replaced
78680:61a6b4b81d6e 78681:38fe769658be
    33           (case (Bytes.content tag, rest) of
    33           (case (Bytes.content tag, rest) of
    34             ("0", []) => Exn.Exn Null
    34             ("0", []) => Exn.Exn Null
    35           | ("1", _) => Exn.Res rest
    35           | ("1", _) => Exn.Res rest
    36           | ("2", [msg]) => Exn.Exn (ERROR (Bytes.content msg))
    36           | ("2", [msg]) => Exn.Exn (ERROR (Bytes.content msg))
    37           | ("3", [msg]) => Exn.Exn (Fail (Bytes.content msg))
    37           | ("3", [msg]) => Exn.Exn (Fail (Bytes.content msg))
    38           | ("4", []) => Exn.interrupt_exn
    38           | ("4", []) => Isabelle_Thread.interrupt_exn
    39           | _ => raise Fail "Malformed Scala.result");
    39           | _ => raise Fail "Malformed Scala.result");
    40       in Synchronized.change results (Symtab.map_entry (Bytes.content id) (K result)) end);
    40       in Synchronized.change results (Symtab.map_entry (Bytes.content id) (K result)) end);
    41 
    41 
    42 in
    42 in
    43 
    43 
    55         Synchronized.guarded_access results
    55         Synchronized.guarded_access results
    56           (fn tab =>
    56           (fn tab =>
    57             (case Symtab.lookup tab id of
    57             (case Symtab.lookup tab id of
    58               SOME (Exn.Exn Match) => NONE
    58               SOME (Exn.Exn Match) => NONE
    59             | SOME result => SOME (result, Symtab.delete id tab)
    59             | SOME result => SOME (result, Symtab.delete id tab)
    60             | NONE => SOME (Exn.interrupt_exn, tab)));
    60             | NONE => SOME (Isabelle_Thread.interrupt_exn, tab)));
    61     in
    61     in
    62       invoke ();
    62       invoke ();
    63       Exn.release (restore_attributes await_result ())
    63       Exn.release (restore_attributes await_result ())
    64         handle exn => (if Exn.is_interrupt exn then cancel () else (); Exn.reraise exn)
    64         handle exn => (if Exn.is_interrupt exn then cancel () else (); Exn.reraise exn)
    65     end) ();
    65     end) ();