Skip to content

Commit

Permalink
Reorder members to avoid unaligned atomic operations on 32-bit archs
Browse files Browse the repository at this point in the history
  • Loading branch information
srebhan committed Dec 6, 2023
1 parent bfcdfdd commit 4f71e65
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions testutil/accumulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ func (p *Metric) String() string {

// Accumulator defines a mocked out accumulator
type Accumulator struct {
sync.Mutex
*sync.Cond

nMetrics uint64 // Needs to be first to avoid unaligned atomic operations on 32-bit archs
Metrics []*Metric
accumulated []telegraf.Metric
nMetrics uint64
Discard bool
Errors []error
debug bool
deliverChan chan telegraf.DeliveryInfo
delivered []telegraf.DeliveryInfo

TimeFunc func() time.Time

sync.Mutex
*sync.Cond
}

func (a *Accumulator) NMetrics() uint64 {
Expand Down

0 comments on commit 4f71e65

Please sign in to comment.