Esempio n. 1
0
 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)
Esempio n. 2
0
 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)))
Esempio n. 3
0
 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)
Esempio n. 4
0
 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)
Esempio n. 5
0
 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)
Esempio n. 6
0
 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)
Esempio n. 7
0
 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)))
Esempio n. 8
0
 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)