fix(diode): atomic.AddUint64 in 32-bit cause panic (#229)

see: https://golang.org/pkg/sync/atomic/#pkg-note-BUG
This commit is contained in:
Jean-Sébastien Didierlaurent 2020-05-11 20:49:43 +02:00 committed by GitHub
parent de5a95dced
commit e86e8f2f49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -9,9 +9,9 @@ import (
// ManyToOne diode is optimal for many writers (go-routines B-n) and a single // ManyToOne diode is optimal for many writers (go-routines B-n) and a single
// reader (go-routine A). It is not thread safe for multiple readers. // reader (go-routine A). It is not thread safe for multiple readers.
type ManyToOne struct { type ManyToOne struct {
buffer []unsafe.Pointer
writeIndex uint64 writeIndex uint64
readIndex uint64 readIndex uint64
buffer []unsafe.Pointer
alerter Alerter alerter Alerter
} }

View File

@ -31,9 +31,9 @@ type bucket struct {
// OneToOne diode is meant to be used by a single reader and a single writer. // OneToOne diode is meant to be used by a single reader and a single writer.
// It is not thread safe if used otherwise. // It is not thread safe if used otherwise.
type OneToOne struct { type OneToOne struct {
buffer []unsafe.Pointer
writeIndex uint64 writeIndex uint64
readIndex uint64 readIndex uint64
buffer []unsafe.Pointer
alerter Alerter alerter Alerter
} }