浏览 178
分享
Use go.uber.org/atomic
Atomic operations with the sync/atomic package operate on the raw types(int32
, int64
, etc.) so it is easy to forget to use the atomic operation toread or modify the variables.
go.uber.org/atomic adds type safety to these operations by hiding theunderlying type. Additionally, it includes a convenient atomic.Bool
type.
Bad | Good |
---|---|
|
|
评论列表