aboutsummaryrefslogtreecommitdiff
path: root/funcs.go
diff options
context:
space:
mode:
authorMatt Joiner <anacrolix@gmail.com>2020-09-30 19:13:27 +1000
committerMatt Joiner <anacrolix@gmail.com>2020-09-30 19:13:27 +1000
commita3e788d52494b75b927538c9c2bfee1573aa50e1 (patch)
treef1eed1cda0c25008c51b375799b9d65a33ce080d /funcs.go
parentDon't sleep and only wake watchers if the variable value has changed (diff)
downloadstm-a3e788d52494b75b927538c9c2bfee1573aa50e1.tar.gz
stm-a3e788d52494b75b927538c9c2bfee1573aa50e1.tar.xz
Wake watchers until the var changes again
Diffstat (limited to 'funcs.go')
-rw-r--r--funcs.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/funcs.go b/funcs.go
index 59c0e74..b8c8464 100644
--- a/funcs.go
+++ b/funcs.go
@@ -74,7 +74,7 @@ retry:
}
// verify the read log
tx.lockAllVars()
- if !tx.verify() {
+ if tx.inputsChanged() {
tx.unlock()
expvars.Add("failed commits", 1)
if profileFailedCommits {
@@ -84,6 +84,10 @@ retry:
}
// commit the write log and broadcast that variables have changed
tx.commit()
+ tx.mu.Lock()
+ tx.completed = true
+ tx.cond.Broadcast()
+ tx.mu.Unlock()
tx.unlock()
expvars.Add("commits", 1)
tx.recycle()