Skip to content

Commit 5fe1f0a

Browse files
committed
rpcclient: Use atomic types.
1 parent 5c424ed commit 5fe1f0a

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

rpcclient/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/decred/dcrd/rpcclient/v8
22

3-
go 1.18
3+
go 1.19
44

55
require (
66
github.com/decred/dcrd/chaincfg/chainhash v1.0.5

rpcclient/infrastructure.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ type jsonRequest struct {
143143
// the returned future will block until the result is available if it's not
144144
// already.
145145
type Client struct {
146-
id uint64 // atomic, so must stay 64-bit aligned
146+
id atomic.Uint64
147147

148148
// config holds the connection configuration associated with this
149149
// client.
@@ -212,7 +212,7 @@ func (c *Client) String() string {
212212
// this function should be used to ensure the ID is unique amongst all requests
213213
// being made.
214214
func (c *Client) NextID() uint64 {
215-
return atomic.AddUint64(&c.id, 1)
215+
return c.id.Add(1)
216216
}
217217

218218
// addRequest associates the passed jsonRequest with its id. This allows the

0 commit comments

Comments
 (0)