aboutsummaryrefslogtreecommitdiff
path: root/funcs.go
diff options
context:
space:
mode:
authorMatt Joiner <anacrolix@gmail.com>2020-10-02 17:35:11 +1000
committerMatt Joiner <anacrolix@gmail.com>2020-10-02 17:35:11 +1000
commitc35a2c748c6ad053344c9f15f6f86246e48628e0 (patch)
treee33b8b691286fb48dd637d47589c4e163af62495 /funcs.go
parentUse builtin eq var in rate and stmutil (diff)
downloadstm-c35a2c748c6ad053344c9f15f6f86246e48628e0.tar.gz
stm-c35a2c748c6ad053344c9f15f6f86246e48628e0.tar.xz
Only wake Tx if they're still reading a modified value
Diffstat (limited to 'funcs.go')
-rw-r--r--funcs.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/funcs.go b/funcs.go
index 91d6bc8..80c25b1 100644
--- a/funcs.go
+++ b/funcs.go
@@ -71,7 +71,9 @@ retry:
time.Sleep(time.Duration(ns))
}
}
+ tx.mu.Lock()
ret, retry := catchRetry(op, tx)
+ tx.mu.Unlock()
if retry {
expvars.Add("retries", 1)
// wait for one of the variables we read to change before retrying