more robust: avoid race condition;
authorwenzelm
Wed, 11 Oct 2023 11:06:34 +0200
changeset 78755 42e48ad59cda
parent 78754 5838285a8245
child 78756 96b3d13606b1
more robust: avoid race condition;
src/Pure/Concurrent/isabelle_thread.ML
--- a/src/Pure/Concurrent/isabelle_thread.ML	Wed Oct 11 10:48:42 2023 +0200
+++ b/src/Pure/Concurrent/isabelle_thread.ML	Wed Oct 11 11:06:34 2023 +0200
@@ -153,8 +153,10 @@
 fun expose_interrupt_result () =
   let
     val orig_atts = Thread_Attributes.safe_interrupts (Thread_Attributes.get_attributes ());
-    val _ = Thread_Attributes.set_attributes Thread_Attributes.test_interrupts;
-    val test = Exn.capture Thread.Thread.testInterrupt ();
+    fun main () =
+      (Thread_Attributes.set_attributes Thread_Attributes.test_interrupts;
+       Thread.Thread.testInterrupt ());
+    val test = Exn.capture main ();
     val _ = Thread_Attributes.set_attributes orig_atts;
   in test end;