From e86e8f2f49efc526371ef6ad56ba97b92c681818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20Didierlaurent?= Date: Mon, 11 May 2020 20:49:43 +0200 Subject: [PATCH] fix(diode): atomic.AddUint64 in 32-bit cause panic (#229) see: https://golang.org/pkg/sync/atomic/#pkg-note-BUG --- diode/internal/diodes/many_to_one.go | 2 +- diode/internal/diodes/one_to_one.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/diode/internal/diodes/many_to_one.go b/diode/internal/diodes/many_to_one.go index 0f562f7..e94a788 100644 --- a/diode/internal/diodes/many_to_one.go +++ b/diode/internal/diodes/many_to_one.go @@ -9,9 +9,9 @@ import ( // 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. type ManyToOne struct { - buffer []unsafe.Pointer writeIndex uint64 readIndex uint64 + buffer []unsafe.Pointer alerter Alerter } diff --git a/diode/internal/diodes/one_to_one.go b/diode/internal/diodes/one_to_one.go index aaf66d1..dd85ab0 100644 --- a/diode/internal/diodes/one_to_one.go +++ b/diode/internal/diodes/one_to_one.go @@ -31,9 +31,9 @@ type bucket struct { // OneToOne diode is meant to be used by a single reader and a single writer. // It is not thread safe if used otherwise. type OneToOne struct { - buffer []unsafe.Pointer writeIndex uint64 readIndex uint64 + buffer []unsafe.Pointer alerter Alerter }