more thorough Lazy.is_finished;
authorwenzelm
Sun, 28 Dec 2014 12:18:01 +0100
changeset 59191 682aa538c5c0
parent 59190 3a594fd13ca4
child 59192 a1d6d6db781b
more thorough Lazy.is_finished;
src/Pure/Concurrent/lazy.ML
--- a/src/Pure/Concurrent/lazy.ML	Sun Dec 28 15:42:34 2014 +1100
+++ b/src/Pure/Concurrent/lazy.ML	Sun Dec 28 12:18:01 2014 +0100
@@ -36,11 +36,15 @@
     Expr _ => NONE
   | Result res => Future.peek res);
 
+fun is_finished (Lazy var) =
+  (case Synchronized.value var of
+    Expr _ => false
+  | Result res =>
+      Future.is_finished res andalso not (Exn.is_interrupt_exn (Future.join_result res)));
+
 fun lazy e = Lazy (Synchronized.var "lazy" (Expr e));
 fun value a = Lazy (Synchronized.var "lazy" (Result (Future.value a)));
 
-fun is_finished x = is_some (peek x);
-
 
 (* force result *)