mirror of
https://github.com/jeremyd/ergo.git
synced 2026-07-28 09:48:13 -07:00
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:
+2
-2
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user