February 2018
Intermediate to advanced
340 pages
9h 43m
English
The package sync, contains the structure Map that is designed to be used concurrently from multiple Go routines. The Map struct, with its methods, mimics the behavior of the map primitive. The Store method is the equivalent of the m[key] = val statement. The Load method is equal to val, ok := m[key] and the Range method provides the ability to iterate through the map. Note that the Range function works with the current state of Map, so if the values are changed during the running Range method, the changes are reflected, but only if the key wasn't already visited. The Range function visits its keys only once.
Read now
Unlock full access