aboutsummaryrefslogtreecommitdiff
path: root/funcs.go
diff options
context:
space:
mode:
authorMatt Joiner <anacrolix@gmail.com>2019-11-04 15:52:42 +1100
committerMatt Joiner <anacrolix@gmail.com>2019-11-04 15:52:42 +1100
commitbbcb2aadd77d362849993806e5c3900b11a1502e (patch)
tree0c3969c1cb031acdf1a23975b850934d130da87d /funcs.go
parentUse atomic pointers for Var data (diff)
downloadstm-bbcb2aadd77d362849993806e5c3900b11a1502e.tar.gz
stm-bbcb2aadd77d362849993806e5c3900b11a1502e.tar.xz
Remove global lock
Diffstat (limited to 'funcs.go')
-rw-r--r--funcs.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/funcs.go b/funcs.go
index bd2cf20..a311c9f 100644
--- a/funcs.go
+++ b/funcs.go
@@ -10,7 +10,7 @@ var (
reads: make(map[*Var]uint64),
writes: make(map[*Var]interface{}),
}
- tx.cond.L = &globalLock
+ tx.cond.L = &tx.mu
return tx
}}
)
@@ -44,14 +44,14 @@ retry:
goto retry
}
// verify the read log
- globalLock.Lock()
+ tx.lockAllVars()
if !tx.verify() {
- globalLock.Unlock()
+ tx.unlock()
goto retry
}
// commit the write log and broadcast that variables have changed
tx.commit()
- globalLock.Unlock()
+ tx.unlock()
tx.recycle()
return ret
}