Go Package atomic: Difference between revisions
Jump to navigation
Jump to search
(Created page with "=External= * https://golang.org/pkg/atomic =Internal= * Standard Library") |
|||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
=External= | =External= | ||
* https://pkg.go.dev/sync/atomic | |||
* | =Internal= | ||
* [[Go_Language_Modularization#atomic|Standard Library]] | |||
* [[Go Package sync|The "sync" package]] | |||
* [[Go_Language_Goroutines#Atomic_Primitives|Goroutines]] | |||
=Overview= | |||
Package atomic provides low-level atomic memory primitives useful for implementing synchronization algorithms. These functions require great care to be used correctly. Except for special, low-level applications, synchronization is better done with [[Go Channels|channels]] or the facilities of the [[Go Package sync|sync package]]. Share memory by communicating; don't communicate by sharing memory. | |||
When goroutines attempt to call any atomic function, they're automatically synchronized agains the variable that is being referenced. |
Latest revision as of 18:43, 20 December 2023
External
Internal
Overview
Package atomic provides low-level atomic memory primitives useful for implementing synchronization algorithms. These functions require great care to be used correctly. Except for special, low-level applications, synchronization is better done with channels or the facilities of the sync package. Share memory by communicating; don't communicate by sharing memory.
When goroutines attempt to call any atomic function, they're automatically synchronized agains the variable that is being referenced.