proper signaling after each state update (NB: ML version does this uniformly via timed_access);
--- a/src/Pure/Concurrent/synchronized.scala Thu Apr 24 12:10:26 2014 +0200
+++ b/src/Pure/Concurrent/synchronized.scala Thu Apr 24 13:10:42 2014 +0200
@@ -68,10 +68,12 @@
/* unconditional change */
- def change(f: A => A) = synchronized { state = f(state) }
+ def change(f: A => A): Unit = synchronized { state = f(state); notifyAll() }
+
def change_result[B](f: A => (B, A)): B = synchronized {
val (result, new_state) = f(state)
state = new_state
+ notifyAll()
result
}
}