Commit 9002d989 authored by Steven Allen's avatar Steven Allen

nit: simplify conditional

parent edeb2d90
......@@ -40,14 +40,12 @@ type Meter struct {
// Mark updates the total.
func (m *Meter) Mark(count uint64) {
if count > 0 {
if atomic.AddUint64(&m.accumulator, count) == count {
just_registered := atomic.CompareAndSwapInt32(&m.registered, 0, 1)
if just_registered {
// I'm the first one to bump this above 0.
// Register it.
globalSweeper.Register(m)
}
if count > 0 && atomic.AddUint64(&m.accumulator, count) == count {
just_registered := atomic.CompareAndSwapInt32(&m.registered, 0, 1)
if just_registered {
// I'm the first one to bump this above 0.
// Register it.
globalSweeper.Register(m)
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment