The sync package delivers synchronization primitives, and, under the hood, it is using thread-safe operations on integers and pointers. We can find these functionalities in another package called sync/atomic, which can be used to create tools specific to the user use case, with better performance and less memory usage.
Atomic operations
Integer operations
There is a series of functions for pointers to the different types of integers:
- int32Â Â
- int64Â Â
- uint32Â Â
- uint64Â Â
- uintptrÂ
This includes a specific type of integer that represents a pointer, uintptr. The operation available for these types are as follows:
- Load: Retrieves the integer value from the pointer
- Store: Stores...