def _SynchronizeTxn(function):
 def sync(txn, *args, **kwargs):
  txn._lock.acquire()
  try:
   Check((txn._state is LiveTxn.ACTIVE), 'transaction closed')
   return function(txn, *args, **kwargs)
  finally:
   txn._lock.release()
 return sync

def _SynchronizeTxn ( function ) : def sync ( txn , * args , ** kwargs ) : txn . _lock . acquire ( ) try : Check ( ( txn . _state is LiveTxn . ACTIVE ) , 'transaction closed' ) return function ( txn , * args , ** kwargs ) finally : txn . _lock . release ( ) return sync
a decorator that locks a transaction during the function call .