aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--stm.go5
1 files changed, 1 insertions, 4 deletions
diff --git a/stm.go b/stm.go
index 39cdec4..cb745a1 100644
--- a/stm.go
+++ b/stm.go
@@ -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()
}