aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Joiner <anacrolix@gmail.com>2020-08-28 09:08:03 +1000
committerMatt Joiner <anacrolix@gmail.com>2020-08-28 09:08:03 +1000
commit148eb229195310021da7f5bc7b5e2ff9f766c7a0 (patch)
tree8d3ca0857fc39fb2be0ca0d1849107918d5ff40d
parentPanic when a transaction blocks after reading nothing (diff)
downloadstm-148eb229195310021da7f5bc7b5e2ff9f766c7a0.tar.gz
stm-148eb229195310021da7f5bc7b5e2ff9f766c7a0.tar.xz
Count wakes for unchanged var version
-rw-r--r--tx.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/tx.go b/tx.go
index cdeac0b..ab800b0 100644
--- a/tx.go
+++ b/tx.go
@@ -43,9 +43,14 @@ func (tx *Tx) wait() {
v.watchers.Store(tx, nil)
}
tx.mu.Lock()
+ firstWait := true
for tx.verify() {
+ if !firstWait {
+ expvars.Add("wakes for unchanged versions", 1)
+ }
expvars.Add("waits", 1)
tx.cond.Wait()
+ firstWait=false
}
tx.mu.Unlock()
for v := range tx.reads {