Documentation ¶
Overview ¶
Package syncmap provides a map that is safe for concurrent use. It is similar to sync.Map, but is simpler, and gives a consistent state for range loops.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Map ¶
type Map[K comparable, V any] struct { // contains filtered or unexported fields }
Map is a map that is safe for concurrent use. It is similar to sync.Map, but is simpler, and gives a consistent state for range loops. It takes two generic types, K (key) and V (value). K must be comparable, and V can be any type.
func (*Map[K, V]) Exclusive ¶
func (m *Map[K, V]) Exclusive(f func(map[K]V))
Exclusive calls a callback with exclusive access to the map. Modifications to the map will be kept.
func (*Map[K, V]) ExclusiveRead ¶
func (m *Map[K, V]) ExclusiveRead(f func(map[K]V))
ExclusiveRead calls a callback with exclusive access to the map. It is not safe to modify the map.
Click to show internal directories.
Click to hide internal directories.