author | haftmann |
Sat, 20 Aug 2011 01:21:22 +0200 | |
changeset 44323 | 4b5b430eb00e |
parent 43719 | ba1b2c918c32 |
child 45248 | 3b7b64b194ee |
permissions | -rw-r--r-- |
/* Title: Pure/Concurrent/volatile.scala Author: Makarius Volatile variables. */ package isabelle class Volatile[A](init: A) { @volatile private var state: A = init def apply(): A = state def change(f: A => A) { state = f(state) } def change_yield[B](f: A => (B, A)): B = { val (result, new_state) = f(state) state = new_state result } }