more reactive interrupt;
authorwenzelm
Tue, 07 Sep 2021 16:54:28 +0200
changeset 74257 bda7a7b3bd41
parent 74256 0ba3952f409a
child 74258 e942eedd9229
more reactive interrupt;
src/Pure/Thy/export.scala
--- a/src/Pure/Thy/export.scala	Tue Sep 07 16:46:18 2021 +0200
+++ b/src/Pure/Thy/export.scala	Tue Sep 07 16:54:28 2021 +0200
@@ -221,7 +221,10 @@
               db.transaction {
                 for ((entry, strict) <- args)
                 yield {
-                  if (progress.stopped) Exn.Res(())
+                  if (progress.stopped) {
+                    entry.body.cancel()
+                    Exn.Res(())
+                  }
                   else if (read_name(db, entry.session_name, entry.theory_name, entry.name)) {
                     if (strict) {
                       val msg = message("Duplicate export", entry.theory_name, entry.name)
@@ -236,7 +239,11 @@
           })
 
     def apply(session_name: String, args: Protocol.Export.Args, body: Bytes): Unit =
-      consumer.send(make_entry(session_name, args, body, cache) -> args.strict)
+    {
+      if (!progress.stopped) {
+        consumer.send(make_entry(session_name, args, body, cache) -> args.strict)
+      }
+    }
 
     def shutdown(close: Boolean = false): List[String] =
     {