diff options
author | lukechampine <luke.champine@gmail.com> | 2016-04-03 12:29:48 -0400 |
---|---|---|
committer | lukechampine <luke.champine@gmail.com> | 2016-04-03 12:32:21 -0400 |
commit | 65f3b7ebc2ebeca40e07b28b7543c39457ed0831 (patch) | |
tree | a867f3ec26b9548e5a786da33ef1926c6d8312f4 | |
parent | add TestSelect and TestCompose (diff) | |
download | stm-65f3b7ebc2ebeca40e07b28b7543c39457ed0831.tar.gz stm-65f3b7ebc2ebeca40e07b28b7543c39457ed0831.tar.xz |
fix AtomicSet bug
-rw-r--r-- | stm.go | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -230,10 +230,7 @@ func AtomicGet(v *Var) interface{} { func AtomicSet(v *Var, val interface{}) { // since we're only doing one operation, we don't need a full transaction globalLock.Lock() - v.mu.Lock() - v.val = val - v.mu.Unlock() - globalCond.Broadcast() + (&Tx{writes: map[*Var]interface{}{v: val}}).commit() globalLock.Unlock() } |