diff options
author | lukechampine <luke.champine@gmail.com> | 2016-03-30 17:05:58 -0400 |
---|---|---|
committer | lukechampine <luke.champine@gmail.com> | 2016-03-30 17:05:58 -0400 |
commit | 4e017ef7a61c760e94d6bdeb6df5cb56a044adfc (patch) | |
tree | dce0d5101e5a7e973d0e786cf18e4dde773ddf56 | |
parent | change Get/Set to AtomicGet/Set (diff) | |
download | stm-4e017ef7a61c760e94d6bdeb6df5cb56a044adfc.tar.gz stm-4e017ef7a61c760e94d6bdeb6df5cb56a044adfc.tar.xz |
fix race condition in tx.Get
-rw-r--r-- | stm.go | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -135,6 +135,8 @@ func (tx *Tx) Get(v *Var) interface{} { return val } // Otherwise, record and return its current value. + globalLock.Lock() + defer globalLock.Unlock() tx.reads[v] = v.val return v.val } |