소스 검색

Do not export methods from sync.Mutex on gauges.

Richard Crowley 11 년 전
부모
커밋
37df06ff62
1개의 변경된 파일5개의 추가작업 그리고 5개의 파일을 삭제
  1. 5 5
      gauge_float64.go

+ 5 - 5
gauge_float64.go

@@ -67,8 +67,8 @@ func (NilGaugeFloat64) Value() float64 { return 0.0 }
 // StandardGaugeFloat64 is the standard implementation of a GaugeFloat64 and uses
 // sync.Mutex to manage a single float64 value.
 type StandardGaugeFloat64 struct {
+	mutex sync.Mutex
 	value float64
-	sync.Mutex
 }
 
 // Snapshot returns a read-only copy of the gauge.
@@ -78,14 +78,14 @@ func (g *StandardGaugeFloat64) Snapshot() GaugeFloat64 {
 
 // Update updates the gauge's value.
 func (g *StandardGaugeFloat64) Update(v float64) {
-	g.Lock()
-	defer g.Unlock()
+	g.mutex.Lock()
+	defer g.mutex.Unlock()
 	g.value = v
 }
 
 // Value returns the gauge's current value.
 func (g *StandardGaugeFloat64) Value() float64 {
-	g.Lock()
-	defer g.Unlock()
+	g.mutex.Lock()
+	defer g.mutex.Unlock()
 	return g.value
 }