core/rawdb, eth/downloader: align 64bit atomic fields

This commit is contained in:
Péter Szilágyi
2019-05-17 01:45:05 +03:00
parent f5d89cdb72
commit f35975ea21
3 changed files with 17 additions and 5 deletions

View File

@ -66,8 +66,12 @@ const (
// reserving it for go-ethereum. This would also reduce the memory requirements
// of Geth, and thus also GC overhead.
type freezer struct {
// WARNING: The `frozen` field is accessed atomically. On 32 bit platforms, only
// 64-bit aligned fields can be atomic. The struct is guaranteed to be so aligned,
// so take advantage of that (https://golang.org/pkg/sync/atomic/#pkg-note-BUG).
frozen uint64 // Number of blocks already frozen
tables map[string]*freezerTable // Data tables for storing everything
frozen uint64 // Number of blocks already frozen
instanceLock fileutil.Releaser // File-system lock to prevent double opens
}