def touch(self): """Ensures that this ref cannot be given a new in-transaction-value by any other transactions for the duration of this transaction""" LockingTransaction.ensureGet().doEnsure(self)
def alter(self, fn, args): "Alters the value of this ref, and returns the new state" current = LockingTransaction.ensureGet().getRef(self) return self.refSet(fn(*RT.cons(current, args)))
def commute(self, fn, args): """Commutes the value of this ref, allowing for it to be updated by other transactions before the commuting function is called""" return LockingTransaction.ensureGet().doCommute(self, fn, args)
def refSet(self, state): """Sets the value of this ref to the desired state, regardless of the current value. Returns the newly set state""" return LockingTransaction.ensureGet().doSet(self, state)
def touch(self): """Ensures that this ref cannot be given a new in-transaction-value by any other transactions for the duration of this transaction""" LockingTransaction.ensureGet().doEnsure(self)
def commute(self, fn, args): """Commutes the value of this ref, allowing for it to be updated by other transactions before the commuting function is called""" return LockingTransaction.ensureGet().doCommute(self, fn, args)
def alter(self, fn, args): "Alters the value of this ref, and returns the new state" current = LockingTransaction.ensureGet().getRef(self) return self.refSet(fn(*RT.cons(current, args)))
def refSet(self, state): """Sets the value of this ref to the desired state, regardless of the current value. Returns the newly set state""" return LockingTransaction.ensureGet().doSet(self, state)