--- a/src/Pure/General/susp.ML Tue Nov 06 13:12:50 2007 +0100
+++ b/src/Pure/General/susp.ML Tue Nov 06 13:12:52 2007 +0100
@@ -2,8 +2,7 @@
ID: $Id$
Author: Sebastian Skalberg and Florian Haftmann, TU Muenchen
-Delayed evaluation. Supposed to be value oriented; may result in
-multiple evaluations in a multi-threaded environment!
+Delayed evaluation. Supposed to be value-oriented.
*)
signature SUSP =
@@ -30,13 +29,18 @@
fun delay f = ref (Delay f);
fun force susp =
- (case ! susp of
- Value v => v
- | Delay f =>
- let
- val v = f ();
- val _ = susp := Value v;
- in v end);
+ let
+ fun forc () = case ! susp
+ of Value v => v
+ | Delay f =>
+ let
+ val v = f ();
+ val _ = susp := Value v;
+ in v end;
+ in case ! susp
+ of Value v => v
+ | Delay _ => NAMED_CRITICAL "sups" forc
+ end;
fun peek susp =
(case ! susp of