Documentation
¶
Overview ¶
Package atomicbitops provides basic bitwise operations in an atomic way. The implementation on amd64 leverages the LOCK prefix directly instead of relying on the generic cas primitives.
WARNING: the bitwise ops provided in this package doesn't imply any memory ordering. Using them to construct locks must employ proper memory barriers.
Index ¶
- func AndUint32(addr *uint32, val uint32)
- func AndUint64(addr *uint64, val uint64)
- func CompareAndSwapUint32(addr *uint32, old, new uint32) uint32
- func CompareAndSwapUint64(addr *uint64, old, new uint64) uint64
- func DecUnlessOneInt32(addr *int32) bool
- func IncUnlessZeroInt32(addr *int32) bool
- func OrUint32(addr *uint32, val uint32)
- func OrUint64(addr *uint64, val uint64)
- func XorUint32(addr *uint32, val uint32)
- func XorUint64(addr *uint64, val uint64)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareAndSwapUint32 ¶
CompareAndSwapUint32 is like sync/atomic.CompareAndSwapUint32, but returns the value previously stored at addr.
func CompareAndSwapUint64 ¶
CompareAndSwapUint64 is like sync/atomic.CompareAndSwapUint64, but returns the value previously stored at addr.
func DecUnlessOneInt32 ¶
DecUnlessOneInt32 decrements the value stored at the given address and returns true; unless the value stored in the pointer is 1, in which case it is left unmodified and false is returned.
func IncUnlessZeroInt32 ¶
IncUnlessZeroInt32 increments the value stored at the given address and returns true; unless the value stored in the pointer is zero, in which case it is left unmodified and false is returned.
Types ¶
This section is empty.