4 ms·
> Go maps are not goroutine safe Which types in Go are goroutine safe? Do we need to use sync.Mutex for all global variables which are read and written in goro
by vinceyuan 11y ago
> Go maps are not goroutine safe
Which types in Go are goroutine safe? Do we need to use sync.Mutex for all global variables which are read and written in goroutines? My understanding is only read-only variables are goroutine safe.
- JulianMorrison 11y agoIf you copy value data inside a mutex, access to the copy you made is goroutine safe.