From 347294ec79f2876be40d0770b31658682bb0de3a Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Mon, 4 Nov 2019 16:23:01 +1100 Subject: Reduce transaction locking on Tx.wait --- tx.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tx.go') 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. -- cgit v1.2.3