Skip to content

Commit

Permalink
Fix issue rubyist#43 [Value alignment issue on 32-bit systems (ARM)]
Browse files Browse the repository at this point in the history
Reordered Breaker struct and added padding to ensure that the 64-bit values have 8-byte alignment on 32-bit systems. This is required by the atomic library for values larger than 4 bytes on 32-bit systems and will cause a panic if that alignment is incorrect.
  • Loading branch information
abferm authored Mar 30, 2017
1 parent 9d2405c commit 864c7cc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion circuitbreaker.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,11 @@ type Breaker struct {
// Clock is used for controlling time in tests.
Clock clock.Clock

_ [4]byte // pad to fix golang issue #599
consecFailures int64
counts *window
lastFailure int64 // stored as nanoseconds since the Unix epoch
halfOpens int64
counts *window
nextBackOff time.Duration
tripped int32
broken int32
Expand Down

0 comments on commit 864c7cc

Please sign in to comment.