Skip to content

Commit

Permalink
Hopefully fixed golang atomic alignment bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Pouzanov committed Mar 16, 2014
1 parent 838a945 commit 1257e1c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion store/watcher_hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import (
// event happens between the end of the first watch command and the start
// of the second command.
type watcherHub struct {
count int64 // current number of watchers. Must be 64-bit aligned
mutex sync.Mutex // protect the hash map
watchers map[string]*list.List
count int64 // current number of watchers.
EventHistory *EventHistory
}

Expand Down
25 changes: 13 additions & 12 deletions third_party/github.com/coreos/go-log/log/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ import (

// Logger is user-immutable immutable struct which can log to several outputs
type Logger struct {
sinks []Sink // the sinks this logger will log to
verbose bool // gather expensive logging data?
prefix string // static field available to all log sinks under this logger
seq uint64 // sequential number of log message, starting at 1, must be 64-bit aligned

created time.Time // time when this logger was created
seq uint64 // sequential number of log message, starting at 1
executable string // executable name
sinks []Sink // the sinks this logger will log to
verbose bool // gather expensive logging data?
prefix string // static field available to all log sinks under this logger

created time.Time // time when this logger was created
executable string // executable name
}

// New creates a new Logger which logs to all the supplied sinks. The prefix
Expand All @@ -42,13 +43,13 @@ type Logger struct {
// filename.
func New(prefix string, verbose bool, sinks ...Sink) *Logger {
return &Logger{
sinks: sinks,
verbose: verbose,
prefix: prefix,
sinks: sinks,
verbose: verbose,
prefix: prefix,

created: time.Now(),
seq: 0,
executable: getExecutableName(),
created: time.Now(),
seq: 0,
executable: getExecutableName(),
}
}

Expand Down
2 changes: 1 addition & 1 deletion third_party/github.com/rcrowley/go-metrics/ewma.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ func (NilEWMA) Update(n int64) {}
// of uncounted events and processes them on each tick. It uses the
// sync/atomic package to manage uncounted events.
type StandardEWMA struct {
uncounted int64 // must be 64-bit aligned
alpha float64
init bool
mutex sync.Mutex
rate float64
uncounted int64
}

// Rate returns the moving average rate of events per second.
Expand Down

0 comments on commit 1257e1c

Please sign in to comment.