From cc0357f5252666ef67bb8f73f86b47ddbdb245be Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Tue, 5 Nov 2019 11:49:42 +1100 Subject: Optimize AtomicSet --- funcs.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'funcs.go') diff --git a/funcs.go b/funcs.go index 3d89cc5..bd7f0e9 100644 --- a/funcs.go +++ b/funcs.go @@ -69,9 +69,9 @@ func AtomicGet(v *Var) interface{} { // AtomicSet is a helper function that atomically writes a value. func AtomicSet(v *Var, val interface{}) { - Atomically(func(tx *Tx) { - tx.Set(v, val) - }) + v.mu.Lock() + v.changeValue(val) + v.mu.Unlock() } // Compose is a helper function that composes multiple transactions into a -- cgit v1.2.3