src/Pure/Concurrent/synchronized.scala
changeset 56694 c4e77643aad6
parent 56692 8219a65b24e3
child 64370 865b39487b5d
equal deleted inserted replaced
56693:0423c957b081 56694:c4e77643aad6
    66     timed_access(_ => None, f).get
    66     timed_access(_ => None, f).get
    67 
    67 
    68 
    68 
    69   /* unconditional change */
    69   /* unconditional change */
    70 
    70 
    71   def change(f: A => A) = synchronized { state = f(state) }
    71   def change(f: A => A): Unit = synchronized { state = f(state); notifyAll() }
       
    72 
    72   def change_result[B](f: A => (B, A)): B = synchronized {
    73   def change_result[B](f: A => (B, A)): B = synchronized {
    73     val (result, new_state) = f(state)
    74     val (result, new_state) = f(state)
    74     state = new_state
    75     state = new_state
       
    76     notifyAll()
    75     result
    77     result
    76   }
    78   }
    77 }
    79 }