--- a/src/Pure/Concurrent/synchronized.ML Tue Jul 28 14:54:53 2009 +0200
+++ b/src/Pure/Concurrent/synchronized.ML Tue Jul 28 15:05:18 2009 +0200
@@ -8,6 +8,7 @@
sig
type 'a var
val var: string -> 'a -> 'a var
+ val peek: 'a var -> 'a
val value: 'a var -> 'a
val timed_access: 'a var -> ('a -> Time.time option) -> ('a -> ('b * 'a) option) -> 'b option
val guarded_access: 'a var -> ('a -> ('b * 'a) option) -> 'b
@@ -32,6 +33,8 @@
cond = ConditionVar.conditionVar (),
var = ref x};
+fun peek (Var {var, ...}) = ! var; (*unsynchronized!*)
+
fun value (Var {name, lock, cond, var}) = SimpleThread.synchronized name lock (fn () => ! var);