You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// AddUint64 atomically adds delta to *addr and returns the new value.
// To subtract a signed positive constant value c from x, do AddUint64(&x, ^uint64(c-1)).
// In particular, to decrement x, do AddUint64(&x, ^uint64(0)).
func AddUint64(addr *uint64, delta uint64) (new uint64)
正确的写法也可参考:go.uber.org/atomic
The text was updated successfully, but these errors were encountered:
如上的代码中
atomic.AddUint64
中传入的数必须是uint64,在注释上说明了减法用类似AddUint64(&x, ^uint64(c-1))
的形式。正确的写法也可参考:go.uber.org/atomic
The text was updated successfully, but these errors were encountered: