From 80ec29f423aeb8f7de75c057b12b2e5cd8cb35ba Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Mon, 4 Nov 2019 15:14:33 +1100 Subject: Use atomic pointers for Var data --- funcs.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'funcs.go') diff --git a/funcs.go b/funcs.go index 47c6273..bd2cf20 100644 --- a/funcs.go +++ b/funcs.go @@ -58,13 +58,7 @@ retry: // AtomicGet is a helper function that atomically reads a value. func AtomicGet(v *Var) interface{} { - // since we're only doing one operation, we don't need a full transaction - globalLock.Lock() - v.mu.Lock() - val := v.val - v.mu.Unlock() - globalLock.Unlock() - return val + return v.loadState().val } // AtomicSet is a helper function that atomically writes a value. -- cgit v1.2.3