diff options
author | Matt Joiner <anacrolix@gmail.com> | 2019-11-04 16:23:01 +1100 |
---|---|---|
committer | Matt Joiner <anacrolix@gmail.com> | 2019-11-04 16:23:01 +1100 |
commit | 347294ec79f2876be40d0770b31658682bb0de3a (patch) | |
tree | de6b669c6edd2357dc4149d3aebb7c99a9583aca | |
parent | Remove global lock (diff) | |
download | stm-347294ec79f2876be40d0770b31658682bb0de3a.tar.gz stm-347294ec79f2876be40d0770b31658682bb0de3a.tar.xz |
Reduce transaction locking on Tx.wait
-rw-r--r-- | tx.go | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -42,17 +42,17 @@ func (tx *Tx) commit() { // wait blocks until another transaction modifies any of the Vars read by tx. func (tx *Tx) wait() { - tx.mu.Lock() // probably can around verify for v := range tx.reads { v.watchers.Store(tx, nil) } + tx.mu.Lock() for tx.verify() { tx.cond.Wait() } + tx.mu.Unlock() for v := range tx.reads { v.watchers.Delete(tx) } - tx.mu.Unlock() // move back to verify? } // Get returns the value of v as of the start of the transaction. |