From d5967f8a78e196cae3da7e2efd654b69a747bfe5 Mon Sep 17 00:00:00 2001 From: sam boyer Date: Fri, 11 Aug 2017 13:50:18 -0400 Subject: [PATCH] Clarify use of atomic in bridge.breakLock() --- internal/gps/bridge.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/gps/bridge.go b/internal/gps/bridge.go index b43bac369f..36751e4cb7 100644 --- a/internal/gps/bridge.go +++ b/internal/gps/bridge.go @@ -195,6 +195,9 @@ func (b *bridge) breakLock() { // No real conceivable circumstance in which multiple calls are made to // this, but being that this is the entrance point to a bunch of async work, // protect it with an atomic CAS in case things change in the future. + // + // We avoid using a sync.Once here, as there's no reason for other callers + // to block until completion. if !atomic.CompareAndSwapInt32(&b.lockbroken, 0, 1) { return }