From b971a8d1ed3642e8fd48a14425e68a408bdf6769 Mon Sep 17 00:00:00 2001 From: rene <41963722+renaynay@users.noreply.github.com> Date: Tue, 11 Jul 2023 21:43:28 +0200 Subject: [PATCH] chore(sync): Rename a variable inside sync_getter locking mech for better readability (#77) --- sync/sync_getter.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sync/sync_getter.go b/sync/sync_getter.go index 5f24de44..b25b2ac1 100644 --- a/sync/sync_getter.go +++ b/sync/sync_getter.go @@ -21,14 +21,14 @@ type syncGetter[H header.Header] struct { func (sg *syncGetter[H]) Lock() bool { // the lock construction here ensures only one routine is freed at a time // while others wait via Rlock - locked := sg.getterLk.TryLock() - if !locked { + acquiredLock := sg.getterLk.TryLock() + if !acquiredLock { sg.getterLk.RLock() defer sg.getterLk.RUnlock() return false } - sg.isGetterLk.Store(locked) - return locked + sg.isGetterLk.Store(acquiredLock) + return acquiredLock } // Unlock unlocks the getter.