use new aligned atomic types everywhere

See 69448b13a1 / #1969; the compiler can now ensure that a uint64
intended for atomic access is always aligned to a 64-bit boundary.
Convert atomic operations on uint32s and pointers as well.
This commit is contained in:
Shivaram Lingamneni 2022-08-10 02:47:39 -04:00
parent 507dc2d838
commit 35128bfc23
6 changed files with 25 additions and 27 deletions

View file

@ -165,7 +165,7 @@ type Session struct {
sasl saslStatus
passStatus serverPassStatus
batchCounter uint32
batchCounter atomic.Uint32
quitMessage string
@ -262,7 +262,7 @@ func (session *Session) HasHistoryCaps() bool {
// or nesting) on an individual session connection need to be unique.
// this allows ~4 billion such batches which should be fine.
func (session *Session) generateBatchID() string {
id := atomic.AddUint32(&session.batchCounter, 1)
id := session.batchCounter.Add(1)
return strconv.FormatInt(int64(id), 32)
}