aboutsummaryrefslogtreecommitdiff
path: root/tx.go
diff options
context:
space:
mode:
Diffstat (limited to 'tx.go')
-rw-r--r--tx.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/tx.go b/tx.go
index 72a58b2..45af14d 100644
--- a/tx.go
+++ b/tx.go
@@ -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.